Responses, Errors & Outages
On this page 14 sections
Status codes and error handling
There is no single error envelope for every QSCS response. Parse by HTTP status, Content-Type and endpoint. Core can return JSON, plain text or an empty body; upstream applications keep their own error formats.
200 and authentication results
| Response | Interpretation |
|---|---|
| 200 application/json from login/logout | Read ok. A false value is failure even though HTTP succeeded. |
| 200 from identity status/federation | Read the lookup fields. Status discovery is not authorization proof. |
200 with X-QSCS-Mode: headless | Saved fallback content; origin may still be unavailable. |
200 text/plain with ok for an unregistered host | Health fallback; not proof the requested route exists. |
| 200 text/event-stream | Process SSE frames, heartbeats and reconnects; not a single JSON object. |
3xx and conditional responses
Upstream redirects preserve Location. A conditional GET /auth/status with a matching If-None-Match returns 304 with no body; reuse the corresponding previously obtained status representation. Other eligible conditional public responses can also return 304. A negotiated empty nochange delta remains HTTP 200.
4xx
| Code | Source / action |
|---|---|
| 400 | Incomplete/oversized headers, malformed request, missing Host, or an unsupported method at the listener method check. Often text/plain. |
| 401 | Protected route rejected missing, unknown, expired, replayed or invalid identity proof. Core body: {"error":"not authenticated"}. It does not expose the exact signature failure. |
| 403 | Application or public-edge denial. Check account permissions; do not assume all 403 responses come from Core. |
| 404 | Remote access to /qscs/metrics or an upstream missing resource. An unknown identity UUID is instead reported in HTTP 200 JSON. |
| 421 | The interpreter rejected an invalid domain-style Host on its routing path. |
5xx
| Code | Source / action |
|---|---|
| 502 | No origin for an application POST, peer/transport failure, or an unusable reconstructed peer state. May be plain text. |
| 503 | Origin unavailable with no safe fallback; POST unavailable; worker/payload capacity exhausted; stream capacity exhausted; or a missing packaged runtime file. Inspect body and headers. |
| 504 | A timed-out peer request on the remote transport path. Not an age-expiry signal for the current generic HEADLESS cache. |
| Upstream 5xx | Application failure forwarded through its delivery path. A completed HTTP error response does not itself prove a connection-level outage. |
Example error bodies
JSON — login failure, HTTP 200
{"ok":false,"error":"authentication failed"}
JSON — protected request, HTTP 401
{"error":"not authenticated"}
JSON — stream capacity, HTTP 503 and Retry-After: 2
{"error":"stream_busy","retry":true}
Plain text — API payload capacity, HTTP 503 and Retry-After: 2
API state busy; retry shortly
An overloaded listener may return plain text QSCS: workers exhausted or an empty 503. Generic fallback errors use plain text. The structured POST outage shape is documented in Responses, Errors & Outages.
Retry and recovery
- Check transport success, HTTP status and media type. Do not call a JSON parser on every failed response.
- Check authentication JSON
okexplicitly. Correct invalid inputs; do not retry rejected credentials automatically. - For transient reads, honour Retry-After if present and use bounded backoff. Every signed retry needs a fresh timestamp and nonce.
- For a federated 401/403, check the issuer account first. Keep a valid issuer session while reporting a recipient resource failure.
- For writes with an uncertain outcome, reconcile state or use application idempotency before resubmitting.
retry:truedoes not mean the operation was unexecuted or safe to replay. - Keep the current key until signed logout is confirmed. A network error does not revoke a binding.
Outage response contract
HEADLESS can serve an eligible saved representation when an origin cannot be reached. It does not guarantee a response for every URL, preserve a valid identity indefinitely or queue writes. Distinguish fallback reads from failed application operations using status, Content-Type and the reason header.
When fallback applies
A failed live attempt can trigger fallback before the origin is classified degraded. Current health constants mark degradation after 10 consecutive failures and recovery after two consecutive successes; background probes run about every 10 seconds. These are implementation settings, not client retry timers.
Cookie-bearing, Authorization-bearing and header-selected application GETs attempt the live origin and return a non-cacheable error if it is unavailable; they must not receive an unrelated anonymous document. Identity verification still applies before a protected read. Explicit federated response caching has its own account and policy checks.
Eligible cached GET
Example HTTP response — selected headers
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-QSCS-Mode: headless
X-QSCS-Headless-Age: 42
X-QSCS-Headless-Reason: served
<cached body>
The current generic fallback accepts a valid cached payload up to 10 MiB. It has no age-based expiry ceiling: inspect the age and surface stale state where freshness matters. Entries remain subject to cache capacity and validity. HTTP 200 in this mode does not mean the origin is healthy.
Unavailable cached GET
| Status / reason | Meaning |
|---|---|
200 / served | Eligible saved representation returned. |
503 / origin_unreachable | No cache entry is available after origin failure. |
503 / invalid_cache | Entry exists but is invalid or unsuitable for generic fallback. |
503 / oversized | Fallback payload exceeds the size ceiling. |
503 / no_cache | Listener has no response-cache service configured. |
Generic fallback errors use text/plain. The historical ttl_expired and bootstrap reason names remain in the implementation but are not emitted by the current generic evaluator; do not build retry logic around them.
Application-specific GET unavailable
Example HTTP response — selected headers
HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Cache-Control: no-store
X-QSCS-Mode: passthrough
X-QSCS-Headless-Reason: application_request_unavailable
{"error":"upstream_unavailable","retry":true,"reason":"application_request_unavailable"}
POST unavailable
Example HTTP response — selected headers
HTTP/1.1 503 Service Unavailable
Content-Type: application/json
X-QSCS-Mode: headless
X-QSCS-Headless-Reason: post_soft_fail
{"error":"upstream_unavailable","retry":true,"reason":"origin_unreachable","host":"app.example.com","uri":"/api/checkout"}
| Field | Type | Meaning |
|---|---|---|
| error | string | upstream_unavailable |
| retry | boolean | true indicates a potentially recoverable service failure; it does not establish that replaying a write is safe. |
| reason | string | origin_unreachable on the current POST failure path. |
| host | string | Requested public origin. |
| uri | string | Requested path and query. |
Client handling
- For an eligible stale GET, show the saved state with its age where appropriate.
- For unavailable reads, keep the last verified view separate from the error, and retry with bounded backoff and fresh signatures. Honour Retry-After when present.
- For a failed write, show that completion is unconfirmed. The origin may have processed the operation before the response was lost. Reconcile with an operation-status read or an application-defined idempotency key before resubmitting.
- Do not display “saved”, silently replay a write, or treat an outage as successful logout. Complete signed revocation when connectivity returns.
QSCS does not provide a generic write outbox or application idempotency store. Those behaviours belong to your application protocol.