Skip to content
AF
Troubleshooting

Undocumented HealthKit Errors: Handling a Case Apple Never Described

Last verified September 4, 2026 · 5 min read

Several HKError cases are published with no description whatsoever: unknownError, errorDataSizeExceeded, errorBackgroundWorkoutSessionNotAllowed, and errorWorkoutActivityNotAllowed all appear as type properties with no abstract and no discussion. Apple documents nothing about when any of them is returned, and the oldest of them has been present since the earliest HealthKit releases without ever acquiring one. A name can legitimately point you at where to look in your own app; it cannot tell you what the framework decided. The workable strategy is to log the raw domain and code, fail soft without discarding the user's data, bound your retries, and keep your inferences labelled as inferences.

Covered here:HealthKit

Some HealthKit errors have no documentation. Not thin documentation, not documentation in a different place — no published description at all. Apple lists the case, the platforms it exists on, and nothing else. If you have landed here holding a code you cannot look up, the goal of this page is to get you to a safe handling strategy without either of you inventing behaviour that Apple never described.

Which cases have no description#

CaseWhere Apple lists itPublished abstractFirst listed on
unknownErrorType propertiesNoneiOS 8.0, watchOS 2.0
errorDataSizeExceededType propertiesNoneiOS 17.0, watchOS 10.0
errorBackgroundWorkoutSessionNotAllowedType propertiesNoneiOS 17.0, watchOS 10.0
errorWorkoutActivityNotAllowedType propertiesNoneiOS 17.0, watchOS 10.0

Two things stand out. One of the oldest cases in the enum is an undescribed one — unknownError goes back to the earliest listed releases and has still never acquired an abstract. And the grouping matters: most of the described cases sit in Apple's accessing-errors listing with abstracts and, often, discussion paragraphs, while these four appear as type properties with the name as the entire published content. Our HealthKit error reference marks this distinction on every case rather than hiding it behind plausible-sounding prose.

What a name lets you infer, and what it does not#

It is reasonable to let a name direct your investigation. It is not reasonable to let it write your error messages, your retry policy, or your documentation. The honest form of the inference looks like this:

CaseA name-led place to lookWhat Apple confirms
errorDataSizeExceededWhatever your app just tried to write, and how large it wasNothing
errorBackgroundWorkoutSessionNotAllowedSession starts happening off the foregroundNothing
errorWorkoutActivityNotAllowedA workout activity being refusedNothing
unknownErrorAnything; it is the catch-all by nameNothing

Every cell in the middle column is a hypothesis for you to test in your own app, on your own data, on a device you control. None of them is a fact about the framework. The two workout cases are handled alongside their documented siblings in workout session errors, where the contrast between a case with a discussion paragraph and a case with nothing at all is easiest to see.

The handling strategy: log raw, fail soft#

  • Log the domain and the numeric code, always. Not a mapped label, not a friendly string — the raw values, alongside the operation, the type identifier, and the size or shape of whatever you passed. When Apple documents the case later, or when the pattern becomes obvious across your install base, those logs are the only thing that will let you go back and interpret past failures.
  • Never map an unknown code to a confident message. "Your workout was too large to save" is a claim about the framework you cannot support. "This didn't save — we've logged the details" costs you nothing and is true.
  • Fail soft and keep the payload. Whatever you were trying to write still exists in your app. Hold it, mark it unsynced, and let a later attempt or a support export recover it. Discarding user data on the strength of an undocumented code is the one genuinely unrecoverable mistake available here.
  • Bound your retries. Allow a small, bounded number of attempts in case the cause was transient, then stop and record the outcome. Cases that are structural rather than environmental will fail identically forever — the transient/terminal split is worked through in HealthKit database inaccessible.
  • Reduce the payload as an experiment, not a fix. If you suspect size, try a smaller write and see. Write down what you observed and label it as your observation.
  • Alert on the shape, not the instance. One unknown code is noise. A sudden cluster on one OS version, one device family, or one code path is a signal worth a person's attention, and it is why the raw code matters more than the friendly message.

Do not confuse "undocumented" with "unclassified"#

There is a second, larger category worth separating: cases Apple does document, which teams treat as mysterious because their logging collapsed everything into one branch. errorInvalidArgument has a one-line abstract and no discussion, but that one line tells you it is a programming error rather than an environmental one, and the diagnosis has a real procedure — see invalid argument. Before concluding that Apple documented nothing, check whether you simply never read the abstract.

SituationWhat it isFirst move
Code has no abstract anywhereGenuinely undocumentedLog raw, fail soft
Code has an abstract but no discussionThinly documentedRead the abstract; it constrains a lot
Your logs say "HealthKit error"An observability problemLog domain and code
Behaviour differs by OS versionPossibly version-specificSegment your telemetry by version

Writing about it honestly#

If your team keeps an internal runbook, hold it to the same rule this site uses: state what the vendor documents, attribute it, and mark your own inferences as inferences. A runbook that says "errorDataSizeExceeded occurs when a sample exceeds the limit" invents both a mechanism and a limit; a runbook that says "no published description; observed in our app when writing large batches, unconfirmed" stays useful and stays true. How we apply that standard across the site is set out in our methodology, and the field-level version of the same argument is in the HealthKit error that never fires.

Where to go next#

Every case in the enum, with Apple's own wording where it exists and an explicit gap where it does not, is in the HealthKit error reference. If your undocumented code arrived from a workout session, go to workout session errors; if it arrived from a query that returned nothing, errorNoData covers the documented version of emptiness. And for the setup underneath all of them, see the HealthKit integration guide.

Frequently asked questions

Which HealthKit error cases has Apple not documented?
unknownError, errorDataSizeExceeded, errorBackgroundWorkoutSessionNotAllowed, and errorWorkoutActivityNotAllowed are published as type properties with no abstract and no discussion. Apple lists their names and the platforms they exist on, and nothing more. Most of the described cases, by contrast, appear in Apple's accessing-errors listing with an abstract and often a discussion paragraph.
Can I infer what errorDataSizeExceeded means from its name?
You can use the name to decide where to look, and no further. A sensible investigation is to examine what your app just tried to write and how large it was. Turning that into a user-facing message about a size limit invents both a mechanism and a threshold that Apple has never published.
How should my app handle an unknown HealthKit error code?
Log the raw domain and numeric code together with the operation and type identifier, keep the data you were trying to write and mark it unsynced, allow a small bounded number of retries, then stop. Alert on clusters rather than single occurrences, and never map an undocumented code to a confident explanation in your UI.

Keep reading

Elsewhere on the site

Pages that share this one’s concepts and sources, from other sections.

Next steps

Was this page useful?

Independent comparison, last reviewed September 4, 2026. Pricing, rate limits, and feature availability change often — confirm current details in each provider’s official documentation before you commit. Product and company names are trademarks of their respective owners; AIFitnessAPI is not affiliated with, endorsed by, or sponsored by any product listed here.

← All troubleshooting · by AIFitnessAPI