Gate Errors

Gate returns structured JSON errors with a machine-readable code and a human-readable message.

{
  "error": "Human readable message",
  "code": "service.error_name"
}

Validation errors also include a fields object with per-field messages.

Common Errors

CodeHTTPCauseFix
validation_error400Invalid request body or parametersCheck fields for details. Ensure flag keys match /^[a-z0-9][a-z0-9_-]*$/ and enabled is a boolean.
unauthorized401Missing or invalid API keyAdd Authorization: Bearer sm_... header. See Authentication.
forbidden403Authenticated but not authorizedVerify you own the flag. Check API key scopes.
not_found404Resource does not existVerify the flag key. Use GET /v1/gate to list all flags.
insufficient_balance402Not enough credits for a billable operationOnly applies to GET /v1/gate/config and GET /v1/gate/:flagKey. See Pricing for tier details.
rate_limit_exceeded429Too many requestsImplement exponential backoff. Use GET /v1/gate/config instead of individual flag checks. See Rate Limits.

Gate-Specific Errors

CodeHTTPCauseFix
gate.feature_not_found404Flag does not existVerify spelling and case. Create the flag via POST /v1/gate if needed.
gate.rule_invalid400Malformed flag valueGate uses boolean-only flags. Ensure values are true or false.
gate.evaluation_failed500Internal error during flag evaluationRetry the request. If it persists, fall back to a safe default and contact support with the flag key and timestamp.

Best Practices

  • Always implement fallback defaults. If Gate returns an error, use a safe default (typically false).
  • Cache the last-known config locally. Serve stale data on failure rather than breaking the user experience.
  • Use bulk config for client SDKs. GET /v1/gate/config fetches all flags in one request. Poll every 30-60 seconds.
  • Flag updates propagate within 60 seconds. For time-sensitive changes, verify via the single-flag endpoint after updating.