Errors and retries
Interpret LakeShark HTTP status codes, structured quota failures, provider errors, and safe retry behavior.
HTTP status semantics
| Status | Meaning | Client action |
|---|---|---|
400 |
Invalid HTTP/request form in an edge path | Correct the request |
401 |
Missing, invalid, expired, or revoked credential | Re-authenticate or replace credential |
403 |
Authenticated but not authorized or no valid workspace context | Check role/context |
404 |
Resource not found within the authorized boundary | Verify resource ID and workspace |
409 |
State conflict | Refresh state before retrying |
413 |
Seed/reference payload too large | Reduce input size/count |
415 |
Unsupported media type | Use a supported seed/reference format |
422 |
Semantically invalid input | Correct field values or policy |
429 |
Rate/quota limit reached | Respect limit and Retry-After where present |
502 |
Required upstream/provider/internal dependency failed | Retry only when operation is safe |
503 |
Required control-plane/storage dependency unavailable | Retry with bounded backoff |
504 |
Public API gateway timed out waiting for an upstream response | Inspect outcome/evidence before retrying mutations or actions |
Error body
Most errors use:
{
"detail": "human-readable or stable error detail"
}
Do not parse prose unless a field is explicitly documented as a stable code.
Quota exceeded
Quota enforcement can return a structured detail object:
{
"detail": {
"code": "quota_exceeded",
"quota": "answer_sets.max",
"limit": 25,
"used": 25,
"remaining": 0
}
}
Quota responses can also include:
X-LakeShark-Quota-Key
X-LakeShark-Quota-Limit
X-LakeShark-Quota-Used
A quota control-plane outage uses 503 with code quota_unavailable rather than silently allowing capacity to exceed the configured limit.
Provider failure codes
Internal provider generation normalizes important upstream failure classes, including:
provider_auth_failedprovider_endpoint_or_model_not_foundprovider_rate_limitedprovider_request_rejectedprovider_upstream_unavailableprovider_generation_failedprovider_timed_outprovider_unreachableprovider_response_invalidprovider_egress_blocked
Management APIs can translate these into a higher-level detail message.
Gateway failures versus backend failures
The public lakeshark-site Worker returns 404 for unsupported /api/<service> routes or unsupported paths outside /healthz, /readyz, and /v1/*. It can return 502 when the upstream request fails at the transport layer and 504 when its own request deadline expires. Backend services may independently return 502 or 503 for other reasons. Do not treat every 502 as a provider failure.
For requests that reach the Worker, X-LakeShark-Edge: site-worker identifies the gateway. X-LakeShark-Upstream-Status appears when the Worker received an upstream HTTP response; X-LakeShark-Upstream-Timeout-Ms reports the configured edge deadline. The current gateway uses 10 seconds for most routes, 20 seconds for provider model discovery/connection tests, 90 seconds for selected generation/management calls, and 180 seconds for Question API and ask-and-execute requests. See API edge routing and deadlines.
Do not interpret 504 as proof that a backend write or outbound action did not happen. In particular, an Automatic ExecutionSet action may have reached its destination before the gateway stopped waiting. Inspect execution evidence and use the documented UUID idempotency key for the same logical Question API request rather than submitting a new action blindly.
Source: public gateway implementation.
Retry guidance
Safe default:
- retry
GETon transient502/503with exponential backoff and jitter - honor
Retry-Afteron429 - do not automatically retry a create/approve/change request unless the operation has a documented idempotency strategy
- do not repeatedly retry
401,403,404, or422without changing state or input - bound total retry time so provider or platform failure does not create an application thread storm
LakeShark APIs do not currently advertise a universal idempotency-key contract. Clients must not assume one.