# Sync diagnostics

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

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

## Wire errors

| Code | What happened |
| --- | --- |
| [`SYNC_ACCOUNT_CHANGED`](https://vitehub.dev/docs/sync/diagnostics/sync_account_changed) (guide) | The writes were made for another account, such as before a sign-in as another user. The server wrote nothing. |
| [`SYNC_ACTION_REFUSED`](https://vitehub.dev/docs/sync/diagnostics/sync_action_refused) (guide) | The action failed. |
| [`SYNC_BAD_REQUEST`](https://vitehub.dev/docs/sync/diagnostics/sync_bad_request) (guide) | The subset column `<name>` is not in `subsets`. Add "\<name\>" to `subsets` in `server/sync/<name>.ts`, such as `defineSync({ subsets: ["<name>"] })`. |
| [`SYNC_FORBIDDEN`](https://vitehub.dev/docs/sync/diagnostics/sync_forbidden) (guide) | The caller is not signed in, and this Sync definition lets only signed-in callers write. Sign in, or set `write: true` to let visitors write. |
| [`SYNC_INVALID`](https://vitehub.dev/docs/sync/diagnostics/sync_invalid) (guide) | See the page of the code. |
| [`SYNC_KEY_EXISTS`](https://vitehub.dev/docs/sync/diagnostics/sync_key_exists) (guide) | A row with the key \<key\> exists already. |
| [`SYNC_NOT_FOUND`](https://vitehub.dev/docs/sync/diagnostics/sync_not_found) (guide) | No row with the key \<key\> is in the scope of the caller. |
| [`SYNC_OUT_OF_SCOPE`](https://vitehub.dev/docs/sync/diagnostics/sync_out_of_scope) (guide) | The write or the subset sets `<column>` to a value that `where` does not allow for this caller. |
| [`SYNC_READ_ONLY`](https://vitehub.dev/docs/sync/diagnostics/sync_read_only) (guide) | This Sync definition has `write: false`, so the browser and the actions of other Sync definitions cannot change its rows. |
| [`SYNC_TOO_MANY_MUTATIONS`](https://vitehub.dev/docs/sync/diagnostics/sync_too_many_mutations) (guide) | The push has \<count\> mutations. One push may have at most \<limit\>. |
| [`SYNC_UNAUTHORIZED`](https://vitehub.dev/docs/sync/diagnostics/sync_unauthorized) (guide) | `where` of this Sync definition refused the caller, and the caller is not signed in. |

## Browser errors

| Code | What happened |
| --- | --- |
| [`SYNC_BROWSER_ONLY`](https://vitehub.dev/docs/sync/diagnostics/sync_browser_only) | Sync writes run in the browser only, and this write ran on the server. |
| [`SYNC_CLEARED`](https://vitehub.dev/docs/sync/diagnostics/sync_cleared) (guide) | `clearSync()` dropped this write before the server confirmed it. |
| [`SYNC_LOCAL_CLOSED`](https://vitehub.dev/docs/sync/diagnostics/sync_local_closed) | An optimistic action changed `local` after it returned, such as after an `await`. |
| [`SYNC_NETWORK`](https://vitehub.dev/docs/sync/diagnostics/sync_network) (guide) | The Sync route could not be reached. |
| [`SYNC_SERVER_ERROR`](https://vitehub.dev/docs/sync/diagnostics/sync_server_error) (guide) | The Sync route answered without a pull. |
| [`SYNC_STORE_DESTROYED`](https://vitehub.dev/docs/sync/diagnostics/sync_store_destroyed) | The Sync store \<name\> was destroyed. |
| [`SYNC_UNKNOWN_FAILURE`](https://vitehub.dev/docs/sync/diagnostics/sync_unknown_failure) | This failure is not in the Sync store. It was retried or dismissed before. |

## Definition and setup errors

| Code | What happened |
| --- | --- |
| [`SYNC_INVALID_DEFINITION`](https://vitehub.dev/docs/sync/diagnostics/sync_invalid_definition) | defineSync(): \<message\> |
| [`SYNC_INVALID_NAME`](https://vitehub.dev/docs/sync/diagnostics/sync_invalid_name) | The Sync definition \<value\> needs a name of lowercase letters, digits, and dashes, such as todos or shopping-list. |
| [`SYNC_NO_DATABASE`](https://vitehub.dev/docs/sync/diagnostics/sync_no_database) | Sync needs a SQLite Database with atomic `batch()`, such as libSQL, D1, or the local default Database. This Database has no `batch()`. |
| [`SYNC_NOT_INSTALLED`](https://vitehub.dev/docs/sync/diagnostics/sync_not_installed) | The running app has no Sync definitions. |
| [`SYNC_UNKNOWN_NAME`](https://vitehub.dev/docs/sync/diagnostics/sync_unknown_name) | No Sync definition is named \<name\>. |
| [`SYNC_UNSUPPORTED_TABLE`](https://vitehub.dev/docs/sync/diagnostics/sync_unsupported_table) | defineSync(): \<message\> |

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

- [Overview](https://vitehub.dev/raw/docs/sync.md)
- [Get started](https://vitehub.dev/raw/docs/sync/get-started.md)
- [Server API](https://vitehub.dev/raw/docs/sync/server-api.md)
- [Limits and errors](https://vitehub.dev/raw/docs/sync/limits-and-errors.md)
- [Vue](https://vitehub.dev/raw/docs/sync/vue.md)

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