# Error codes

Source: https://cubibase.com/docs/reference/errors

Also available: [Markdown version](https://cubibase.com/docs/reference/errors.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt)

Every error is a JSON object with a stable code, a message, and a requestId. Match on the code, not the message text.

## The error shape

**Error response**

```json
{
  "error": {
    "code": "missing_end_user_token",
    "message": "An end-user bearer token is required",
    "requestId": "req_example"
  }
}
```

Some errors add a `details` field (for example, which quota was exceeded). The `requestId` appears in the project’s request logs, so you can trace a failure from the Console.

## Authentication and sessions

| Status | Code | Cause and fix |
| --- | --- | --- |
| `401` | `missing_api_key` | Send the publishable key in the `apikey` header |
| `401` | `invalid_api_key` | The key is not active for this project; check or rotate it |
| `401` | `missing_end_user_token` | Send the user’s JWT as `Authorization: Bearer …` |
| `401` | `invalid_token` | Expired or unverifiable JWT; refresh the session |
| `401` | `session_revoked` | The session was revoked; sign in again |
| `401` | `mfa_required` | The project requires an MFA-verified session |
| `401` | `invalid_credentials` | Wrong email or password |
| `401` | `invalid_refresh_token` | Expired, revoked, or reused refresh token; sign in again |
| `401` | `invalid_challenge` | MFA challenge expired or already used |
| `401` | `invalid_mfa_code` | Wrong TOTP code |
| `401` | `invalid_id_token` | Google ID token failed verification or nonce check |
| `403` | `user_banned` | The user is banned in the Console |
| `403` | `signup_disabled` | Signup is switched off for the project |
| `403` | `password_signin_disabled` | Password sign-in is switched off |
| `403` | `anonymous_disabled` | Enable Allow anonymous sign-ins in Providers |
| `403` | `provider_disabled` | Enable Google sign-in in Providers |
| `403` | `mfa_disabled` | Enable MFA before enrolling factors |
| `403` | `mfa_enrollment_required` | Required MFA: the user must enroll a factor first |
| `400` | `weak_password` | Meet the minimum length; do not reuse the email |
| `400` | `conversion_requires_credentials` | Anonymous conversion needs email and password together |
| `400` | `unsupported_grant` | grant_type must be password, refresh_token, mfa, or id_token |
| `400` | `unsupported_provider` | Only the google provider is supported |
| `400` | `invalid_redirect` | redirect_to is not a valid http(s) URL |
| `400` | `redirect_not_allowed` | Add the URL to the App redirect allowlist |
| `400` | `invalid_state` | OAuth state missing, expired, or already used |
| `400` | `email_required` | The Google account did not provide an email |
| `409` | `user_exists` | A user with that email already exists |
| `409` | `identity_exists` | The Google account is linked to another user |
| `409` | `email_mismatch` | The Google email differs from the signed-in user’s |
| `429` | `rate_limited` | Too many attempts; back off and retry later |

## Data API

| Status | Code | Cause and fix |
| --- | --- | --- |
| `400` | `invalid_filter` | Filters must be `column=op.value` with a supported operator |
| `400` | `invalid_column` | Unknown column, or a bad `select` list |
| `400` | `invalid_order` | order must be `column.asc` or `column.desc` (max 3) |
| `400` | `invalid_body` | Body must be a non-empty JSON object (max 64 fields); on RPC, named arguments that fit the parameters |
| `400` | `validation_error` | limit/offset out of range, or a bad row id |
| `400` | `not_null_violation` | A required column was omitted |
| `400` | `check_violation` | A value failed a check constraint |
| `400` | `invalid_input` | A value does not fit the column type |
| `400` | `numeric_overflow` | A number is out of range for the column |
| `403` | `forbidden` | The row policy rejected the read or write, or the api role lacks a table grant inside an RPC function |
| `404` | `not_found` | Unknown or unexposed table, a missing/hidden row, or an RPC function without a matching grant and arguments |
| `405` | `method_not_allowed` | Expose that operation on the table |
| `408` | `statement_timeout` | The query timed out; simplify it |
| `409` | `conflict` | Unique constraint violated |
| `409` | `foreign_key_violation` | The referenced row does not exist |
| `300` | `ambiguous_function` | Several RPC overloads match the arguments; details lists the signatures |
| `413` | `result_too_large` | An RPC set-returning function produced more than 10000 rows |

## Database objects (Console)

The Database menu managers — policies, functions, triggers, indexes, types, views — return these codes when a definition is rejected. Everything they manage lives in the public schema.

| Status | Code | Cause and fix |
| --- | --- | --- |
| `400` | `validation_error` | A name, expression, or option failed validation; the details list the field |
| `400` | `invalid_definition` | PostgreSQL rejected the definition (e.g. a bad function body) |
| `400` | `invalid_column` | An expression or index references a column the table does not have |
| `400` | `invalid_sql` | The statement could not be executed as written |
| `400` | `undefined_function` | A trigger or expression references a function that does not exist |
| `400` | `not_supported` | The requested operation is not supported for that object |
| `403` | `extension_function` | The function belongs to an extension; it cannot be edited or dropped. Disable the extension instead |
| `404` | `not_found` | The object does not exist in the public schema |
| `409` | `already_exists` | An object with that name already exists |
| `409` | `object_in_use` | Other objects depend on it; drop the dependents first |

## Storage

The /storage/v1 endpoints return these codes. Quota errors include the limit and current consumption in details; private objects never leak their existence to unauthorized callers.

| Status | Code | Cause and fix |
| --- | --- | --- |
| `402` | `STORAGE_PROJECT_QUOTA_EXCEEDED` | Project storage full; delete objects or upgrade |
| `402` | `STORAGE_ACCOUNT_QUOTA_EXCEEDED` | Account-wide storage full; delete objects or upgrade |
| `402` | `STORAGE_BANDWIDTH_QUOTA_EXCEEDED` | Monthly download budget exhausted; resets next billing cycle |
| `413` | `STORAGE_FILE_TOO_LARGE` | File exceeds the plan or bucket maximum |
| `403` | `STORAGE_BUCKET_ACCESS_DENIED` | The caller cannot access this bucket |
| `410` | `STORAGE_UPLOAD_EXPIRED` | Upload session expired; start a new upload |
| `404` | `STORAGE_OBJECT_NOT_FOUND` | Missing object, or private and not visible to you |
| `409` | `storage_object_exists` | Path already taken; pass overwrite: true to replace |
| `415` | `storage_mime_not_allowed` | MIME type not in the bucket allowlist |

## Functions

The /functions/{name} gateway returns these codes before or around execution. Quota and concurrency refusals never reach the runtime and are not metered as invocations. Execution failures (a thrown error or a timeout) return 500 with the invocation id; the details live in Executions & Logs, never in the caller response.

| Status | Code | Cause and fix |
| --- | --- | --- |
| `401` | `invalid_signature` | HMAC signature missing or wrong; sign the exact raw bytes you send |
| `401` | `signature_timestamp_expired` | Timestamp outside the tolerance window; use the current unix time |
| `401` | `signature_replayed` | The nonce was already used; generate a fresh nonce per delivery |
| `402` | `FUNCTIONS_QUOTA_EXCEEDED` | Monthly invocations or GB-seconds exhausted; upgrade or wait for the cycle reset |
| `404` | `function_not_found` | Unknown function, no enabled HTTP trigger, or an internal-only function |
| `409` | `function_disabled` | The function is disabled; enable it in the Console |
| `409` | `function_not_deployed` | No active deployment yet; deploy the function first |
| `409` | `signature_not_configured` | HMAC mode is on but no signing secret exists; rotate the signature secret |
| `413` | `request_too_large` | Body exceeds the platform function request limit |
| `429` | `FUNCTIONS_CONCURRENCY_LIMIT` | All concurrent execution slots are busy; retry shortly |
| `429` | `rate_limited` | Per-project HTTP rate limit reached; back off and retry |
| `502` | `response_too_large` | The handler returned an oversized response; return less data |
| `503` | `functions_disabled` | Functions is switched off on this engine deployment |

Management APIs (Console) additionally return `validation_error` for bad names, cron expressions or configurations, `name_conflict` when a secret and a variable share a name, `already_exists` for duplicate triggers, and `deployment_not_ready` when activating a version that is not ready.

## Project and platform

| Status | Code | Cause and fix |
| --- | --- | --- |
| `402` | `quota_exceeded` | A shared quota (MAU, API requests, bandwidth, function invocations or compute) or a database-size limit was reached; `details` carries the resource, scope, usage, limit and reset date. Upgrade, reduce usage, or (paid plans) enable additional usage in Console → Billing → Additional Usage |
| `402` | `spending_limit_reached` | The organization enabled additional usage and its estimated metered spending reached the monthly spending limit; `details` carries the limit and current spend. Included quotas are unaffected. Raise the limit, reduce usage, or wait for the billing-period reset |
| `403` | `project_suspended` | Account over quota past the grace period; upgrade or reduce |
| `403` | `project_paused` | Free project idle 14 days; resume from the Console |
| `404` | `project_not_found` | Unknown slug, or the project is not active yet |
| `409` | `project_not_ready` | Provisioning has not finished |
| `400` | `invalid_sql` | The SQL editor accepts one read-only statement |
| `403` | `read_only` | The statement cannot modify data |
| `500` | `internal_error` | Unexpected failure; retry, and contact support with the requestId |

## Additional resources

- [API routes](https://cubibase.com/docs/reference/routes) Where each error can come from.
- [Quotas and suspension](https://cubibase.com/docs/platform/quotas) The 402 and 403 project states in detail.
- [Pause, archive, restore](https://cubibase.com/docs/platform/lifecycle) What project_paused means and how to clear it.
