# Comments diagnostics

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

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

## Runtime errors

| Code | What happened |
| --- | --- |
| [`COMMENTS_R0001`](https://vitehub.dev/docs/comments/diagnostics/comments_r0001) | createAnchor() found nothing to anchor to for \<target\>. |
| [`COMMENTS_R0002`](https://vitehub.dev/docs/comments/diagnostics/comments_r0002) | The comment thread "\<id\>" does not exist. |
| [`COMMENTS_R0003`](https://vitehub.dev/docs/comments/diagnostics/comments_r0003) | The comment message "\<messageId\>" does not exist in this thread. |
| [`COMMENTS_R0004`](https://vitehub.dev/docs/comments/diagnostics/comments_r0004) | Only the author of a message can edit or delete it. |
| [`COMMENTS_R0005`](https://vitehub.dev/docs/comments/diagnostics/comments_r0005) | A comment needs some text. |
| [`COMMENTS_R0006`](https://vitehub.dev/docs/comments/diagnostics/comments_r0006) | server/comments.ts defines no authorize policy, so a production build lets in only people signed in with GitHub who can push to the repository, and people that the Console admits to its Comments section. Other signed-in people, such as users of ViteHub Auth or identify, get nothing. |
| [`COMMENTS_R0007`](https://vitehub.dev/docs/comments/diagnostics/comments_r0007) | A page subject takes an app path that starts with one "/", such as "/pricing", without "?" or "#". |
| [`COMMENTS_R0008`](https://vitehub.dev/docs/comments/diagnostics/comments_r0008) | The comment subject kind "\<kind\>" is not defined. |
| [`COMMENTS_R0009`](https://vitehub.dev/docs/comments/diagnostics/comments_r0009) | This user or Agent may not \<action\> this comment. |
| [`COMMENTS_R0010`](https://vitehub.dev/docs/comments/diagnostics/comments_r0010) | The comments runtime is not installed. |
| [`COMMENTS_R0011`](https://vitehub.dev/docs/comments/diagnostics/comments_r0011) | The comment numbers of this scope are busy. |
| [`COMMENTS_R0012`](https://vitehub.dev/docs/comments/diagnostics/comments_r0012) | Writing a comment needs a signed-in user. |
| [`COMMENTS_R0013`](https://vitehub.dev/docs/comments/diagnostics/comments_r0013) | The comments request did not get an answer from the server. |
| [`COMMENTS_R0014`](https://vitehub.dev/docs/comments/diagnostics/comments_r0014) | Comments has no place to store attachments: the app has no Blob store and no storeAttachment hook. |
| [`COMMENTS_R0015`](https://vitehub.dev/docs/comments/diagnostics/comments_r0015) | The comment list kept changing while its pages were loading. |
| [`COMMENTS_R0016`](https://vitehub.dev/docs/comments/diagnostics/comments_r0016) | The thread is resolved, so it takes no new replies. |
| [`COMMENTS_R0017`](https://vitehub.dev/docs/comments/diagnostics/comments_r0017) | The file data is not Base64. |
| [`COMMENTS_R0018`](https://vitehub.dev/docs/comments/diagnostics/comments_r0018) | \<path\>: \<value\> |
| [`COMMENTS_R0019`](https://vitehub.dev/docs/comments/diagnostics/comments_r0019) | The vitehub_comment_threads table misses columns of this version: \<value\>. |
| [`COMMENTS_R0020`](https://vitehub.dev/docs/comments/diagnostics/comments_r0020) | No comment that you may read has the attachment \<key\>, or its file is gone. |
| [`COMMENTS_R0021`](https://vitehub.dev/docs/comments/diagnostics/comments_r0021) | Comments stores attachments with storeAttachment, but has no readAttachment to read them back. |
| [`COMMENTS_R0022`](https://vitehub.dev/docs/comments/diagnostics/comments_r0022) | Another comment thread of this scope already uses this requestId: it has another author or another subject, or you may not read it. |

## Build errors

| Code | What happened |
| --- | --- |
| [`COMMENTS_B0001`](https://vitehub.dev/docs/comments/diagnostics/comments_b0001) | \<file\> needs a Database, but the Database is off for this app. |
| [`COMMENTS_B0002`](https://vitehub.dev/docs/comments/diagnostics/comments_b0002) | \<file\> must export defineComments(), as `comments` or as the default export. |
| [`COMMENTS_B0003`](https://vitehub.dev/docs/comments/diagnostics/comments_b0003) | comments() from @vite-hub/comments/vite is for apps without vitehub(). In this app vitehub() owns the Comments configuration. |
| [`COMMENTS_B0004`](https://vitehub.dev/docs/comments/diagnostics/comments_b0004) | The `database` option of defineComments() in \<file\> is not a string literal. The build reads it without running the file, so Comments would use the default Database. |

## Errors

| Code | What happened |
| --- | --- |
| [`COMMENTS_CONTENT_MISSING`](https://vitehub.dev/docs/comments/diagnostics/comments_content_missing) | Inline edits need Content, and the app has no `server/content.ts` with document collections. |
| [`COMMENTS_FIELD_CONFLICT`](https://vitehub.dev/docs/comments/diagnostics/comments_field_conflict) | The document of \<field\> changed after the page read it. |
| [`COMMENTS_FIELD_FORBIDDEN`](https://vitehub.dev/docs/comments/diagnostics/comments_field_forbidden) | `content.can()` denied `write` on the document of \<field\> for this user. |
| [`COMMENTS_FIELD_INVALID`](https://vitehub.dev/docs/comments/diagnostics/comments_field_invalid) | \<field\> is not a Content field address, or its collection, document, or field does not exist. |
| [`COMMENTS_FIELD_LOCKED`](https://vitehub.dev/docs/comments/diagnostics/comments_field_locked) | \<holder\> holds the edit lease of this document in the Console. |
| [`COMMENTS_FIELD_NOT_EDITABLE`](https://vitehub.dev/docs/comments/diagnostics/comments_field_not_editable) | The draft value of \<field\> is not a string, so it cannot be edited as text on the page. |
| [`COMMENTS_FORBIDDEN`](https://vitehub.dev/docs/comments/diagnostics/comments_forbidden) | The `authorize` policy of `defineComments()` denied `<action>` for this user. |
| [`COMMENTS_INVALID_INPUT`](https://vitehub.dev/docs/comments/diagnostics/comments_invalid_input) | The comment input is not valid: \<issue\> |
| [`COMMENTS_NOT_FOUND`](https://vitehub.dev/docs/comments/diagnostics/comments_not_found) | No comment thread or comment has the id \<id\>. |
| [`COMMENTS_NOT_INSTALLED`](https://vitehub.dev/docs/comments/diagnostics/comments_not_installed) | The Comments runtime has no Database yet. ViteHub installs it from `server/comments.ts` when the server starts. |
| [`COMMENTS_POLICY_MISSING`](https://vitehub.dev/docs/comments/diagnostics/comments_policy_missing) | `server/comments.ts` has no `authorize` policy, so a production build lets in only people signed in with GitHub who can push to the repository, and people that the Console admits to its Comments section. |
| [`COMMENTS_RESOLVED`](https://vitehub.dev/docs/comments/diagnostics/comments_resolved) | The thread is resolved, so it takes no new replies. |

## Named errors

| Code | What happened |
| --- | --- |
| [`COMMENTS_GITHUB_CREDENTIALS_MISSING`](https://vitehub.dev/docs/comments/diagnostics/comments_github_credentials_missing) | Comments needs GitHub credentials to post to pull requests: VITEHUB_GITHUB_APP_ID with VITEHUB_GITHUB_PRIVATE_KEY, or VITEHUB_GITHUB_TOKEN. |
| [`COMMENTS_GITHUB_REQUEST_FAILED`](https://vitehub.dev/docs/comments/diagnostics/comments_github_request_failed) | GitHub GET \<path\> failed with \<status\> |
| [`COMMENTS_GITHUB_SYNC_FAILED`](https://vitehub.dev/docs/comments/diagnostics/comments_github_sync_failed) | GitHub \<request\> failed with \<status\>: \<reason\> |
| [`COMMENTS_GUEST_RATE_LIMITED`](https://vitehub.dev/docs/comments/diagnostics/comments_guest_rate_limited) | This address sent too many guest comments\<value\>. |
| [`COMMENTS_MIGRATION_DATABASE_UNSUPPORTED`](https://vitehub.dev/docs/comments/diagnostics/comments_migration_database_unsupported) | migrateComments() needs a Drizzle database with batch() or transaction(), so a failure changes nothing. |
| [`COMMENTS_MIGRATION_LIVE_POSTGRES`](https://vitehub.dev/docs/comments/diagnostics/comments_migration_live_postgres) | The live-site comments model had no Postgres tables, so there is nothing to move. |
| [`COMMENTS_RATE_LIMIT_INVALID`](https://vitehub.dev/docs/comments/diagnostics/comments_rate_limit_invalid) | defineComments(): \<issue\> |
| [`COMMENTS_SECRET_TOO_SHORT`](https://vitehub.dev/docs/comments/diagnostics/comments_secret_too_short) | VITEHUB_SECRET must be at least \<minimum\> characters. Generate one with `openssl rand -base64 32`. |

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

- [Overview](https://vitehub.dev/raw/docs/comments.md)
- [Get started](https://vitehub.dev/raw/docs/comments/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/comments/configure.md)
- [Server API](https://vitehub.dev/raw/docs/comments/server-api.md)
- [Hosts](https://vitehub.dev/raw/docs/comments/hosts.md)
- [Limits and errors](https://vitehub.dev/raw/docs/comments/limits-and-errors.md)
- [With ViteHub](https://vitehub.dev/raw/docs/comments/with-vite-hub.md)
- [Operations overview](https://vitehub.dev/raw/docs/comments/operations.md)
- [Operations tutorial](https://vitehub.dev/raw/docs/comments/operations/get-started.md)
- [Configure operations](https://vitehub.dev/raw/docs/comments/operations/configure.md)
- [Operations server API](https://vitehub.dev/raw/docs/comments/operations/server-api.md)
- [Operations limits and errors](https://vitehub.dev/raw/docs/comments/operations/limits-and-errors.md)

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