HealthKit Error with HKStatisticsCollectionQuery iOS 14

Getting an error response description of

Unable to invalidate interval: no data source available.

With HKStatisticsCollectionQuery when requesting active/basal energy burned on iOS 14.0.1. This was previously working fine. The request is aggregating the data in 1-day buckets.

I am using a Cordova plugin wrapper to make the calls to the HealthKit interface but this error does not originate from the plugin.

I found another thread related with no follow-up answer (https://developer.apple.com/forums/thread/650864). Was wondering where this error originates from exactly to try and debug further.
same here...
I am also seeing this -- any workarounds?
I managed to work around this bug, which I first noticed in iOS14.0.1, by breaking up my HKStatisticsCollectionQuery into 4 smaller queries. By experimentation, it seems like the bug is triggered by a query resulting in a large number of elements. My query that was having issues was 1-day buckets over a year for HKQuantityTypeIdentifierDistanceWalkingRunning, but breaking it up into 4, 3-month queries reliably works for me.

HealthKit Error with HKStatisticsCollectionQuery iOS 14
 
 
Q