So I put some self.Debug statments in. I used these rather than self.Log because this error does no show up in the log file and even if it did the debug works a bit better at this I think.
The code with the debug statements is below and an excerpt of the console output is here:
252 | 15:40:05: Launching analysis for ee9de87bd2c6f7839e9c6e2d1a79fe8c with LEAN Engine v2.4.0.0.3712
253 | 15:40:05: End Init
254 | 15:40:05: Begin UniverseGetter
255 | 15:40:05: End UniverseGetter
256 | 15:40:05: Begin OnSecuritiesChanged
257 | 15:40:05: End OnSecuritiesChanged
258 | 15:40:05: Begin OnData 2018-04-06 10:00:00
259 | 15:40:05: end OnData 2018-04-06 10:00:00
260 | 15:40:05: Error: not found in portfolio. Request this data when initializing the algorithm.
261 | 15:40:05: Begin OnData 2018-04-06 11:00:00
262 | 15:40:05: Begin OnData 2018-04-06 12:00:00
263 | 15:40:05: Begin OnData 2018-04-06 13:00:00
264 | 15:40:05: Begin OnData 2018-04-06 14:00:00
265 | 15:40:05: Begin OnData 2018-04-06 15:00:00
266 | 15:40:05: Begin OnData 2018-04-06 16:00:00
267 | 15:40:05: Begin UniverseGetter
268 | 15:40:05: End UniverseGetter
You can see from the placement that the error is occuring after the first onData runs and before the next begins. It is not in initialization and it is not in the code related to reading the universe. Given that the error message is missing a field value between "Error:" and "not found in portfolio" it seems to be a deep error.
Thanks for any help.