---
title: HKError.Code.errorDatabaseInaccessible
framework: healthkit
role: symbol
role_heading: Case
path: healthkit/hkerror/code/errordatabaseinaccessible
---

# HKError.Code.errorDatabaseInaccessible

The HealthKit data is unavailable because it’s protected and the device is locked.

## Declaration

```swift
case errorDatabaseInaccessible
```

## Mentioned in

Executing Statistics Collection Queries

## Discussion

Discussion This error occurs when your app queries for HealthKit data while the device is locked. You can, however, still save data. This data is saved into a temporary file, which is merged with HealthKit’s data when the user unlocks their device.

## See Also

### Errors

- [HKError.Code.errorHealthDataUnavailable](healthkit/hkerror/code/errorhealthdataunavailable.md)
- [HKError.Code.errorHealthDataRestricted](healthkit/hkerror/code/errorhealthdatarestricted.md)
- [HKError.Code.errorInvalidArgument](healthkit/hkerror/code/errorinvalidargument.md)
- [HKError.Code.errorAuthorizationDenied](healthkit/hkerror/code/errorauthorizationdenied.md)
- [HKError.Code.errorAuthorizationNotDetermined](healthkit/hkerror/code/errorauthorizationnotdetermined.md)
- [HKError.Code.errorRequiredAuthorizationDenied](healthkit/hkerror/code/errorrequiredauthorizationdenied.md)
- [HKError.Code.errorUserCanceled](healthkit/hkerror/code/errorusercanceled.md)
- [HKError.Code.errorAnotherWorkoutSessionStarted](healthkit/hkerror/code/erroranotherworkoutsessionstarted.md)
- [HKError.Code.errorUserExitedWorkoutSession](healthkit/hkerror/code/erroruserexitedworkoutsession.md)
- [HKError.Code.errorNoData](healthkit/hkerror/code/errornodata.md)
