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.
Topic:
App & System Services
SubTopic:
Core OS
Tags: