Dashboard

Errors

Error response formats, HTTP status codes, and OpenFeature error codes.

The Toggld API uses standard HTTP status codes. The response body format depends on the API surface:

SurfaceError format
Management API, sync, and authenticationA JSON object with a _tag field that names the error
OFREP evaluationAn OFREP error object with key and errorCode
Rate limitingA JSON object with a code field

Management API errors

Management errors are JSON objects. _tag names the error, and message explains it. Some errors add fields.

{
  "_tag": "FlagValidationError",
  "flagKey": "new-checkout",
  "issues": ["defaultVariant 'ghost' is not a declared variant"],
  "message": "Flag 'new-checkout' is invalid: defaultVariant 'ghost' is not a declared variant"
}

Use _tag in code. The message text can change.

Status_tagExtra fieldsCause
400NoneNoneThe request body, path, or query does not match the expected shape, or it is not valid JSON. The response has no body.
400EnvironmentRequiredThe request reads or changes flag values, but it names no environment. API keys and public tokens always belong to an environment, so in practice only dashboard sessions get this error.
401UnauthorizedThe credential is missing, unknown, or revoked. See Authentication.
402FlagLimitExceededlimit, currentThe workspace reached its flag limit. During the beta, the limit is ten flags.
403ForbiddenThe credential is valid but cannot use this endpoint.
404FlagNotFoundflagKeyNo flag with this key exists in the credential's environment.
404SegmentNotFoundsegmentKeyNo segment with this key exists.
404EnvironmentNotFoundenvironmentNo environment with this ID or key exists.
404ApiKeyNotFoundkeyIdNo API key with this ID exists.
409FlagAlreadyExistsflagKeyA flag with this key already exists.
409FlagConflictflagKeyThe flag changed after you read it. Read it again, then retry.
409SegmentAlreadyExistssegmentKeyA segment with this key already exists.
409SegmentConflictsegmentKeyThe segment changed after you read it. Read it again, then retry.
409SegmentReferencedsegmentKey, flagKeysThe segment cannot be deleted, because the listed flags reference it.
409EnvironmentAlreadyExistsenvironmentAn environment with this key already exists.
409EnvironmentConflictThe environment change conflicts with the workspace. You cannot delete the last environment, and a new order must list every environment exactly once.
422FlagValidationErrorflagKey, issuesThe flag is not valid. Each entry of issues describes one problem.
422SegmentValidationErrorsegmentKey, issuesThe segment or member change is not valid, for example more than 5,000 members.
429Nonecode, messageYou reached a rate limit. See below.
503Nonecode, messageA required service is unavailable. Retry later.

Common validation issues

FlagValidationError lists problems such as these:

  • A variant value does not match the flag type.
  • The default or off variant is not one of the variants.
  • A rule serves a variant that does not exist.
  • A rollout has no splits, has no positive weight, or has a negative weight.
  • A condition operand has the wrong type for its operator. See Operators.
  • A rule references a segment that does not exist.
  • A request tries to change the flag type.

OFREP evaluation errors

The OFREP endpoints follow the OFREP specification.

Single evaluation

POST /ofrep/v1/evaluate/flags/{key} returns:

StatusBodyCause
200{ "key", "value", "reason", "variant", "metadata" }Success. variant and metadata appear when present.
400{ "key", "errorCode", "errorDetails" }Evaluation failed. errorDetails explains why.
400{ "key", "errorCode": "PARSE_ERROR", "errorDetails" }The request body is not valid JSON.
400{ "key", "errorCode": "INVALID_CONTEXT", "errorDetails" }The request body is JSON but does not match { "context": { … } }.
401{ "_tag": "Unauthorized", "message" }The credential is missing or wrong.
404{ "key", "errorCode": "FLAG_NOT_FOUND" }No flag with this key exists in the environment.
{
  "key": "new-checkout",
  "errorCode": "TARGETING_KEY_MISSING",
  "errorDetails": "Flag 'new-checkout' rule 'rollout' requires a bucketing key but none was provided"
}

Bulk evaluation

POST /ofrep/v1/evaluate/flags returns HTTP 200 with { "flags": [...] }. Each entry is either a success or a per-flag error with key, errorCode, and optional errorDetails. Check each entry for errorCode.

If the request body is not valid, the API returns HTTP 400 with { "errorCode", "errorDetails" } and no key: PARSE_ERROR when the body is not valid JSON, and INVALID_CONTEXT when it does not match { "context": { … } }.

Error codes

Toggld uses the OpenFeature error codes.

Error codeWhere it comes fromMeaning
FLAG_NOT_FOUNDAPI and SDKNo flag with this key exists in the environment.
TARGETING_KEY_MISSINGAPI and SDKA rollout matched, but the context has no usable bucketing key. See Missing bucketing key.
GENERALAPI and SDKAnother failure. From the API, for example, a rule served a variant that does not exist. From the SDK, a network error, a timeout, a server error, or a rejected request such as HTTP 401 or 429.
TYPE_MISMATCHSDKThe flag value does not match the typed getter.
PROVIDER_NOT_READYSDKA local-mode client has no snapshot yet.
PARSE_ERRORAPI and SDKFrom the API, the request body is not valid JSON. From the SDK, it could not decode a response.
INVALID_CONTEXTAPIThe request body is JSON but not a valid evaluation request.
PROVIDER_FATALNeitherDefined by OpenFeature and part of the response schema. The Toggld API and SDK do not return it today.

When evaluation fails, the Node.js SDK returns your fallback value and reports reason: "ERROR" with the error code. See Error handling.

Rate limit errors

When you exceed a limit, the API returns HTTP 429 with a Retry-After header, in seconds:

HTTP/1.1 429 Too Many Requests
Retry-After: 12
Cache-Control: no-store
{ "code": "RATE_LIMITED", "message": "Too many requests. Try again later." }

If the rate limiter itself is unavailable, the API refuses the request with HTTP 503, Retry-After: 5, and the code RATE_LIMIT_UNAVAILABLE. See Rate limits.

Retry guidance

StatusRetry?
400, 401, 402, 403, 404, 422No. Fix the request or the credential first.
409Read the resource again, then send a new request.
429Yes, after the Retry-After interval.
503Yes, after Retry-After when present, with backoff.
Network errors and timeoutsYes, with backoff. For writes, read the resource first to check whether the earlier request succeeded.

On this page