# Errors

Read the `message` first. It says what is wrong in plain words. Then `details`, when there is one.

## Codes of the REST API, the CLI and MCP

| Code                  | HTTP | Cause                                                     | What to do                                                  |
| --------------------- | ---- | --------------------------------------------------------- | ----------------------------------------------------------- |
| `UNAUTHENTICATED`     | 401  | no token, or it ended or was removed                      | the person connects again                                   |
| `FORBIDDEN`           | 403  | the permission is missing, or the person is not a manager | connect again with the permission, or ask a manager         |
| `NOT_FOUND`           | 404  | it does not exist, **or this person cannot see it**       | check the id with `list_apps`                               |
| `CONFLICT`            | 409  | it changed in the meantime, or its state forbids this     | read it again, then decide                                  |
| `PAYLOAD_TOO_LARGE`   | 413  | too big                                                   | send less. Over 1 MiB, use the CLI instead of `deploy_app`  |
| `VALIDATION_FAILED`   | 422  | the files or values are not valid                         | fix each entry of `details`. The same call will fail again  |
| `QUOTA_EXCEEDED`      | 429  | a limit of the app or the workspace                       | see [Limits](https://boring-cloud.app/docs/limits.md). Waiting a minute does not help |
| `RATE_LIMITED`        | 429  | too many calls                                            | wait a minute                                               |
| `INTERNAL`            | 500  | a problem of the platform                                 | try once more, then report it with the `requestId`          |
| `DEPLOYMENT_FAILED`   | 502  | the release could not be finished                         | read the message, then try again once                       |
| `RUNTIME_UNAVAILABLE` | 503  | the release did not start, or the runtime did not answer  | check the backend as below                                  |

After a failed deployment, the previous release is still live.

## Deployment problems

| Message contains                             | Fix                                                                                    |
| -------------------------------------------- | -------------------------------------------------------------------------------------- |
| `must contain index.html`                    | send `index.html` at the root of the assets, not in a folder                           |
| `manifest.entry is set but no worker`        | send the backend, or remove `entry`                                                    |
| `a worker module was uploaded but`           | add `"entry": "dist/worker.mjs"` to the manifest                                       |
| `must be an ES module with a default export` | use `export default { async fetch(request, env) { … } }`, not `module.exports`         |
| `database: true requires a backend entry`    | add a backend, or set `"database": false`                                              |
| `turned off databases`                       | IT decided this. Set `"database": false`, or ask IT                                    |
| `unsupported file type`                      | see the list in [Frontend](https://boring-cloud.app/docs/frontend.md)                                            |
| `is reserved by the platform`                | rename files under `api/` or `_boringcloud/`                                           |
| `duplicate path`                             | two files differ only by upper and lower case                                          |
| `content does not match`                     | the file is not what its extension says. Check the base64                              |
| `sha256 mismatch`, `size mismatch`           | compute them on the decoded bytes, or leave them out over MCP                          |
| `contains a password or key`                 | remove it from each file in `details.issues`, see [Releases](https://boring-cloud.app/docs/releases.md)          |
| `release failed to start`                    | a syntax error, an `import` that was not bundled, or code at the top level that throws |
| `release health check returned HTTP`         | answer `/__boringcloud/health` before reading the user or the database                 |
| `give either text or contentBase64`          | each file needs exactly one of the two                                                 |

## Problems in a running app

| What people see                                 | Usual cause                                                                                             |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Blank page, nothing happens                     | an inline `<script>`, or a script from another site. The browser console says "Content Security Policy" |
| `unauthenticated`, status 401                   | the session ended. The page should reload. See [Frontend](https://boring-cloud.app/docs/frontend.md)                              |
| `cross-origin request rejected`                 | the page called the app with the address of another host. Use `/api/…`                                  |
| `The app backend failed to handle this request` | an exception that was not caught, or too much CPU time                                                  |
| `Not found` for every `/api/` address           | the release has no backend                                                                              |
| `Blocked redirect to another origin`            | the backend redirected outside the app                                                                  |
| `egress_blocked`                                | the backend called an address that is not approved. See [External APIs](https://boring-cloud.app/docs/external-apis.md)           |
| `no such table`                                 | a query ran before the tables were created. See [Database](https://boring-cloud.app/docs/database.md)                             |
| `D1_TYPE_ERROR`                                 | `undefined` was bound. Use `null`                                                                       |
| `You don't have access to this app`             | access was removed, or the app is disabled                                                              |
| `Not deployed yet`                              | no release was published                                                                                |

Agents cannot read the logs of an app. While you look for a problem, let the backend return a short code for each kind of failure, and ask the person what the page shows.
