# Device diagnostics

<!-- Generated by docs/modules/diagnostics from the package catalogs. Write a guide in docs/diagnostics/<CODE>.md instead of editing this file. -->

Each Device error has a stable `code`. Its `docs` link opens the page of that code. This page lists all 9 codes, and [All diagnostics](https://vitehub.dev/docs/reference/diagnostics) lists every primitive.

## Errors

| Code | What happened |
| --- | --- |
| [`DEVICE_ALREADY_OPEN`](https://vitehub.dev/docs/device/diagnostics/device_already_open) | `openDevice()` was called with the version \<version\>, and the device is already open with the version \<open\>. |
| [`DEVICE_FETCH_FAILED`](https://vitehub.dev/docs/device/diagnostics/device_fetch_failed) | GET \<url\> answered \<status\>. `useStoredFetch()` keeps what the read shows, and the device does not store the answer. |
| [`DEVICE_INVALID_ACCOUNT`](https://vitehub.dev/docs/device/diagnostics/device_invalid_account) | `setDeviceAccount()` got \<account\>. It takes the id of the signed-in account, or `null` after a sign-out. |
| [`DEVICE_INVALID_KEY`](https://vitehub.dev/docs/device/diagnostics/device_invalid_key) | `useStoredData()` got the key \<key\>. A key must be a string that is not empty. |
| [`DEVICE_INVALID_MAX_AGE`](https://vitehub.dev/docs/device/diagnostics/device_invalid_max_age) | `maxAge` is \<maxAge\>. It must be a number of milliseconds that is 0 or more. |
| [`DEVICE_NOT_OPEN`](https://vitehub.dev/docs/device/diagnostics/device_not_open) | `useStoredData()` keeps the answer in memory only, because the app did not call `openDevice()`. A reload shows the default, not the stored copy. |
| [`DEVICE_STORAGE_FAILED`](https://vitehub.dev/docs/device/diagnostics/device_storage_failed) | IndexedDB failed to \<action\>. The stored copies on the device can be out of date. |
| [`DEVICE_VALUE_NOT_JSON`](https://vitehub.dev/docs/device/diagnostics/device_value_not_json) | The loader of `<key>` returned a value that JSON cannot store, so the device does not keep it. |
| [`DEVICE_VALUE_TOO_LARGE`](https://vitehub.dev/docs/device/diagnostics/device_value_too_large) | The answer of `<key>` has \<bytes\> bytes as JSON. The device keeps at most \<limit\> bytes, so it does not keep this answer. |

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/device.md)
- [Get started](https://vitehub.dev/raw/docs/device/get-started.md)
- [Browser API](https://vitehub.dev/raw/docs/device/browser-api.md)
- [Limits and errors](https://vitehub.dev/raw/docs/device/limits-and-errors.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
