Every error answer has the same body, with an HTTP status that says the kind of failure:
{
"error": {
"code": "PLAN_LIMIT_REACHED",
"message": "The Free plan allows 3 cubes; delete one or change plans to add another",
"requestId": "4bf92f3577b34da6a3ce929d0e0e4736",
"limit": "cubes",
"max": 3,
"used": 3,
"plan": "free"
}
}codeis a stable name. Handle errors bycode, not bymessage.messagesays what went wrong, in words. For a4xxanswer it is safe to show. For a5xxanswer, show a message of your own.requestIdidentifies the request. Give it to support when you ask about an answer.fieldnames the field a validation error is about, such asrevision. Some4xxanswers have it.cubescomes only withDATABASE_REFERENCED: it names the cubes whose variables refer to the database.limit,max,usedandplancome only withPLAN_LIMIT_REACHED.limitis one ofcubes,previews,build_minutes,bandwidth_gb,free_organizations,sizeordatabases.maxandusedare counted in its unit.
The codes below are not the only ones: a new code can appear. Handle a code you don't know by its HTTP status.
The request is wrong
| Status | Code | What to do |
|---|---|---|
400 | VALIDATION_ERROR | The request is not valid. field names the field to fix, when there is one. A body over 1 MiB (413) or a body that isn't JSON (415) has this code too. |
401 | UNAUTHENTICATED | The key is missing, unknown, expired or revoked. Check the Authorization header, or make a new key. |
403 | FORBIDDEN | The key may not do this: its access level or its owner's role doesn't allow it, or the organization isn't the key's. Use a Full key, a key of an owner with the right role, or the key's own organization. |
403 | API_KEY_NOT_ALLOWED | The operation belongs to the dashboard. No key can call it. See what a key can't do. |
400 | ENV_KEY_RESERVED | The key of a variable or secret is set by Cubecen, such as PORT or a name that starts with CUBECEN_. Choose another key. |
400 | ENV_TOO_LARGE | The variables are over a limit. A cube can have 200 entries, a value can be 64 KiB, and keys and values together can be 256 KiB. |
404 | NOT_FOUND | Nothing is at this address. Check the IDs, slugs and query values. |
404 | INSTALLATION_NOT_FOUND | The GitHub connection isn't one of the organization's. Check github_installation_id. |
The plan or the state of the cube says no
| Status | Code | What to do |
|---|---|---|
402 | PLAN_LIMIT_REACHED | The organization's plan doesn't allow this. limit, max, used and plan say which limit. Free up room, wait for the plan's next period, or change plans, then try again. A refused request leaves nothing behind. |
409 | CONFLICT | The request conflicts with the current state, such as a slug that is already taken. It can also mean the request expired and needs a new Idempotency-Key. |
409 | IDEMPOTENCY_KEY_REUSED | The Idempotency-Key was already used for a different request. Use a new key for a new action. |
409 | BUILD_IN_PROGRESS | This commit is already queued or being built. Follow that build. |
409 | DEPLOYMENT_IN_PROGRESS | A release of this cube is already in progress. Wait for it, or cancel it. |
409 | APPLICATION_NOT_READY | The cube is still being created, or its creation failed. Read the cube until its state is active. |
409 | BUSY | Another operation on this cube is in progress. Retry in a few seconds. |
409 | BUILD_NOT_DEPLOYABLE | Only a successful build can be deployed. Check the build's release_status. |
409 | SIZE_UNAVAILABLE | The size isn't offered right now. Choose a smaller size. |
409 | ENV_CHANGED | The variables changed since you read them: expected_version is not the current version. Read them again, check your change and send it again. |
409 | ENV_VERSION_UNAVAILABLE | The variables of that version are no longer kept, or can't be read, so it can't be brought back or compared. |
409 | DOMAIN_TAKEN | The hostname is taken: another cube serves it, or this cube already has it. A domain can also fail with this code in its error, when another cube proved the hostname first. |
409 | DOMAIN_LIMIT_REACHED | The cube has as many custom domains as it can have, 10. Remove one first. |
409 | DATABASE_NOT_READY | The database isn't ready yet. A build or a deployment of a cube that refers to it gets this code too. Read it until its status is ready, then try again with a new Idempotency-Key. |
409 | DATABASE_REFERENCED | Cubes refer to the database in their variables, and cubes names them. A database they refer to can't be deleted, and its slug can't change. Change their variables first. |
422 | ENV_REFERENCE_BROKEN | A variable refers to a cube or database that is no longer in the project, to a database that is being deleted, or to the private address of a cube that has none yet. Change the variable, or wait a minute for the address, then try again with a new Idempotency-Key. |
A refusal with BUILD_IN_PROGRESS, DEPLOYMENT_IN_PROGRESS or PLAN_LIMIT_REACHED sticks to the Idempotency-Key of the request it refused. To try again, send a new key.
GitHub says no
| Status | Code | What to do |
|---|---|---|
422 | REPOSITORY_NOT_ACCESSIBLE | Cubecen can't read the repository: the access was removed, GitHub blocks it, or a public repository is no longer public or has moved. |
422 | REVISION_NOT_FOUND | The branch, tag or commit isn't in the repository. |
422 | REPOSITORY_EMPTY | The repository has no commits yet. Push a commit, then try again with a new Idempotency-Key. |
422 | GITHUB_INSTALLATION_REMOVED | The Cubecen GitHub App is no longer installed on the GitHub account. Connect GitHub again in the dashboard. |
422 | GITHUB_INSTALLATION_SUSPENDED | The Cubecen GitHub App is suspended on the GitHub account. An owner of the account can unsuspend it on GitHub. |
422 | GITHUB_PERMISSIONS_MISSING | The GitHub account hasn't approved a permission the Cubecen GitHub App needs. An owner of the account can approve it on GitHub. |
502 | GITHUB_UNAVAILABLE | GitHub is temporarily unavailable. Retry the same request. |
503 | GITHUB_RATE_LIMITED | GitHub's rate limit was reached. Retry after the seconds in Retry-After. |
Slow down, then retry
| Status | Code | What to do |
|---|---|---|
429 | RATE_LIMITED | The key made too many requests. Wait for the seconds in Retry-After, then retry. See Rate limits. |
500 | INTERNAL_ERROR | Something went wrong on our side. Retry; if it keeps failing, give support the requestId. |
503 | DATABASE_UNAVAILABLE | The service is temporarily unavailable. Retry the same request with backoff. |
503 | MAINTENANCE | The platform is in maintenance. Builds and other changes are paused for a short while. Retry after the seconds in Retry-After. |
503 | DATABASES_UNAVAILABLE | Databases are temporarily unavailable. Retry the same request with backoff. |
503 | LOGS_UNAVAILABLE | Logs are temporarily unavailable. Retry the same request with backoff. A log stream that breaks off sends an unavailable event with this code and a cursor: open the stream again with it. |
503 | METRICS_UNAVAILABLE | Metrics are temporarily unavailable. Retry after the seconds in Retry-After. |
503 | REQUEST_TIMEOUT | The request took too long and was stopped. Its work may still have been done: retry with backoff, and with the same Idempotency-Key when the request takes one. |
Any other 5xx
A 5xx answer is a failure on our side, or of a service we rely on. Any 5xx that isn't listed above is a temporary outage: retry with backoff, which means waiting a little longer after each failed attempt. If it keeps failing, give support the requestId.
When the request takes an Idempotency-Key, retry with the same key: you get the first answer, and the work isn't done twice. See Requests.