Skip to content
Hexel StudioDocs

Errors

The error responses the Hexel Studio API and token service return, and what each one means.

On this page

Errors come from two places, with two JSON shapes:

  • The gateway at api.hexelstudio.com answers before your request reaches a service: missing or invalid credentials, rate limits, unknown paths, timeouts. Its body is an error object.
  • The service that handles the request answers everything else: permissions, validation, plan limits, conflicts. Its body has an error string, sometimes with more fields.

The token service at sts.hexelstudio.com uses a third, OAuth-style shape. See Token service errors.

Most responses, including errors, carry an X-Request-Id header. Include it when you contact support.

Gateway errors

JSON
{
  "error": {
    "code": "401",
    "message": "Authentication is required or the provided credentials are invalid."
  }
}

code is the HTTP status as a string. message is meant for people; don't match on it.

StatusmessageCause
401Authentication is required or the provided credentials are invalid.No Authorization header or API key, or the access token is expired, malformed or not issued by Hexel Studio.
401Invalid API key.The X-API-Key value is not a valid, active API key.
403X-Organization-Id does not match the API key's organization.You sent an API key and an X-Organization-Id for a different organization.
403Internal endpoint is not publicly accessible.The path is not part of the public API.
404Resource not foundNo public API matches the path.
408The server timed out waiting for the request.The request body arrived too slowly.
413The request body exceeds the maximum allowed size.The body is too large.
429Rate limit exceeded. Try again later.You hit a rate limit. See Rate limits.
429Too many invalid API key attempts. Try again later.Too many requests with invalid API keys came from your IP address.
500An unexpected error occurred on the server.A gateway error. Retry later.
502The gateway received an invalid response from the upstream service.The service failed. Retry later.
503API key authentication is temporarily unavailable.The API key could not be checked. Retry later.
503The service is temporarily unavailable.The service is down or restarting. Retry later.
504The upstream service did not respond in time.The service was too slow. Retry later.

A 502 or 504 can also arrive as an HTML page from Hexel Studio's network edge instead of this JSON.

Rate limits

Identity and access endpoints are rate limited per minute, per caller and per organization. A request over a limit gets 429 with the gateway body above and these headers:

HeaderMeaning
Retry-AfterSeconds until the current one-minute window ends. Wait at least this long.
X-RateLimit-LimitThe limit you exceeded, in requests per minute.
X-RateLimit-ScopeWhich limit: principal_reads, principal_writes, principal_sensitive_writes, org_reads or org_writes.

For the values and what each scope counts, see Limits.

Service errors

Most service errors have a single error field. It is either a short code, such as forbidden, or a sentence:

JSON
{ "error": "forbidden" }
JSON
{ "error": "workspace not found" }

If you send X-Organization-Id with an access token for a different organization, the service can't identify you and answers 401 unauthorized or 403 forbidden.

Match on the HTTP status and on the named codes below. Treat other error text as a message for people; it can change.

Named error codes

StatuserrorMeaning
401unauthorizedThe service could not identify the caller.
403forbiddenThe caller is not allowed to do this. See Permission errors.
403quota_exceededA plan limit was reached. See Plan limit errors.
409last_ownerThe change would leave the organization without an owner. See Members.
422not_org_memberYou tried to add someone to a workspace who is not a member of its organization. See Workspaces.

last_owner and not_org_member also have a message:

JSON
{
  "error": "last_owner",
  "message": "the organization must keep at least one owner"
}

Permission errors

A 403 forbidden means the caller's policies don't allow the action in this organization, workspace or environment. Some responses name what is missing.

When an endpoint needs one specific permission, the body can include it as required:

JSON
{ "error": "forbidden", "required": "iam:role:write_trust" }

When you try to grant access you don't hold yourself, for example by attaching a policy, the body lists the actions you are missing:

JSON
{
  "error": "forbidden",
  "reason": "cannot grant actions the caller does not hold",
  "missing_actions": ["iam:policy:write"]
}

A member-rank refusal is also 403, with a sentence in error, such as "cannot assign role equal or higher than your own". See Members.

To find out why a request was denied, see Test access.

Plan limit errors

JSON
{
  "error": "quota_exceeded",
  "quota_key": "workspaces_per_org",
  "limit": 3,
  "current": 3,
  "message": "plan limit reached: this organization can have at most 3 workspaces; upgrade the plan or contact Hexel"
}
FieldMeaning
quota_keyThe limit: workspaces_per_org, environments_per_workspace, members_per_org or invitations_per_day.
limitYour organization's limit.
currentHow many you have now.
messageA sentence for people.

See Limits.

Other status codes

StatusWhen
400The body is not valid JSON, a required field is missing, or a value is not allowed, such as an unknown member role. error describes the problem.
404The resource doesn't exist. A resource of another organization also answers 404, so you can't tell the two apart.
409The request conflicts with existing data, for example a duplicate name.
503POST /v1/organizations returns 503 while the new organization is still being set up. Send the same request again; see below.

The organization-setup response looks like this:

JSON
{
  "error": "organization provisioning is pending; retry the same request",
  "org_id": "<org-id>",
  "provisioning_status": "PENDING"
}

Token service errors

The token service (https://sts.hexelstudio.com/token and its other endpoints) answers with an error field and, for some errors, an error_description:

JSON
{
  "error": "invalid_grant",
  "error_description": "subject_token was revoked"
}
StatuserrorMeaning
400invalid_requestA required parameter is missing, such as subject_token or resource.
400invalid_targetThe resource (the role to assume) is not valid.
400unsupported_token_typeThe subject_token_type is not supported.
400unsupported grant_typeThe grant_type is not one the token service accepts. The response lists the supported ones in supported.
401invalid_grantThe subject token is not a valid Hexel Studio access token, or it was revoked.
403access_deniedYou may not assume the role, for example because its trust policy does not allow you. See Roles.
403organization context deniedYou are not an active member of the organization you asked for, or it is not active.
429rate_limitedToo many tokens were issued for this credential in the last minute.
503temporarily_unavailableTry again later.

Other token service errors have a sentence in error, such as "invalid api key", "invalid client credentials", "refresh token expired" or "token revoked". See Authenticate to the API and Tokens.