Thanks for sending me the form definition and more information about the devices, @Saad. I've done some analysis and I doubt very much that it has anything to do with the form definition or with Aggregate.
That both the instance id and the start time which are set by the same process are both missing strongly points to something going wrong in Collect. The hypothesis I have right now is that it's related to a crash we're seeing in our analytics but that we can't reproduce. We added some code to initialize Mapbox maps for use with offline layers and that seems to be crashing on some devices. If that crash happened right as a form was loading, it could possibly lead to the behavior you're experiencing.
What I find unsatisfying about this hypothesis is that the crash affects a relatively small percentage of our users so it's surprising that you would have seen it multiple times. How many data collectors do you have total? Have you seen it again? This initialization only happens once per device so if this were the cause, you wouldn't see it more than once per data collector. Do you have reason to believe it has happened more than once for a data collector?
For those familiar with the Collect implementation, all preloading happens in
FormLoaderTask.initializeForm. Changing all the calls to
formDef.initialize to have a
false value for their first parameter leads to instances with no preloads. I've thoroughly looked at
FormDef.initialize and I don't think that there's any way for it to crash or somehow not preload the main instance if the first parameter is
true. However, the Mapbox crash is deep in native code so it could interrupt that process. But then the only way I can see for Collect to go down the branch where
FormDef.initialize has a
false first parameter is if a savepoint file was saved. I can't figure out how a savepoint file could be saved before the
FormLoaderTask completes. So it feels quite inconclusive.
Unfortunately I don't think I can do a whole lot more here. If anyone else has experienced this it would be really helpful to know it.