Error Handling
Nebula errors follow standard HTTP semantics and map to typed SDK exceptions so applications can decide when to fail fast and when to retry safely.At a glance
- Never retry 401/403 without changing credentials or permissions; treat 429/5xx as transient with jittered backoff and a cap.
- Log the correlation/request ID from error responses for debugging while avoiding sensitive data in logs.
Common errors
Status | When it happens | Action |
---|---|---|
400/422 | Invalid inputs or schema violations | Fix request and do not retry until corrected; log validation details safely. |
401 | Missing/invalid Authorization header or key | Do not retry without changing credentials; re-authenticate and reissue. |
403 | Authenticated but insufficient permissions/scope | Do not retry; adjust key scope/permissions and try again. |
404 | Resource or cluster not found | Verify identifiers or scope; do not blind-retry. |
409 | Conflict (state/version) | Resolve conflict or use idempotency/versioning before retry. |
429 | Rate limited | Retry with capped exponential backoff and jitter; respect server hints if present. |
5xx | Transient server error | Retry with capped exponential backoff and jitter; escalate if persistent. |
Exception hierarchy and HTTP mapping
Exception | Typical HTTP | Meaning |
---|---|---|
NebulaException | Varies | Base class with status code, message, details, and request_id . |
NebulaClientException | N/A | Client/network/configuration issues before a response. |
NebulaAuthenticationException | 401 | Invalid or missing authentication. |
NebulaAuthorizationException | 403 | Authenticated but insufficient permissions. |
NebulaRateLimitException | 429 | Rate limit exceeded; transient. |
NebulaValidationException | 400/422 | Invalid parameters or payload. |
NebulaNotFoundException | 404 | Resource or cluster not found. |
Error payloads
Nebula error responses include a stable shape with non-sensitive context and a correlation ID for support and tracing.When to retry
- Retry 429 and 5xx with capped exponential backoff and jitter to spread retries and reduce contention.
- Do not retry 400/401/403/404 without changing the request, credentials, or permissions; these are not transient.
Backoff with jitter
Use capped exponential backoff with full jitter; prefer idempotency for writes.Language examples
- Catch specific exceptions first, then fall back to the base type for a single reporting/logging path.
- Include the request context and status code in logs, and avoid logging secrets or full payloads containing sensitive data.
Notes on idempotency and conflicts
- Use idempotency keys for non-idempotent writes to avoid duplicate effects when retrying.
- Resolve 409 conflicts via versioning or by reconciling state before retrying.