Platform and Tenant Errors
Platform misconfiguration errors (500/503), background failures in the log, exposing error details in dev, and tenant request diagnostics.
Errors that come from the deployment rather than the request: missing bindings or secrets, background failures, and diagnostics for requests served by a tenant Durable Object. The response format is on Errors.
Platform misconfiguration (500 / 503)
A deploy that is missing something the Worker needs fails by name, in every environment. Binding names, secret names, config keys and feature names are identifiers, not secrets, so production bodies carry them too; secret values never appear in a body or a log.
| Code | Status | When | Body names |
|---|---|---|---|
MISSING_ENV | 503 | A boot-required secret is unset (or malformed) — BETTER_AUTH_SECRET, the database URL, ENCRYPTION_KEK, the VAPID keys, required secrets. Checked before routing. | missing (the secret names), requestId |
BINDING_MISSING | 500 | Code that needs a Cloudflare binding ran on a Worker or environment where it is not bound — realtime's BROADCASTER / BROADCASTER_SHARD, the file-storage R2 bucket, and others. layer: "platform". | details: { binding, kind, feature, configKey } and a hint |
{
"detail": "BINDING_MISSING: realtime needs the Durable Object namespace binding BROADCASTER, which is not bound on this Worker",
"layer": "platform",
"code": "BINDING_MISSING",
"details": { "binding": "BROADCASTER", "kind": "Durable Object namespace", "feature": "realtime", "configKey": "realtime" },
"hint": "Declare realtime in quickback/quickback.config.ts, re-run `quickback build`, and deploy with the generated wrangler.toml so BROADCASTER is bound. Wrangler does not inherit bindings into [env.<name>] blocks, and a declared Worker only gets what its bindTo lists — bind BROADCASTER on every Worker and environment that runs realtime code."
}The usual cause is a binding declared at the top level of wrangler.toml but
not in an [env.<name>] block (Wrangler does not inherit bindings), or a
declared Worker whose bindTo omits it. Where the
failure happens off the request path — a realtime publish after a write, a
queue job, a cron tick — there is no response, so the log line is the signal:
each carries event: "binding.missing" with the same fields. The main Worker
also logs one binding.missing line per isolate at boot for each realtime
binding it lacks, without refusing requests.
A route that catches an error and answers 500 INTERNAL_ERROR (storage upload,
presign, confirm, the operator routes) still puts the BINDING_MISSING message
in details.reason in production — the one cause EXPOSE_ERROR_STACK
does not gate, because it carries no data.
Background failures in the log
Queue consumers, cron schedules and workflow dispatch log one JSON line per failure, with the redacted error and what identifies the work:
event | Identifies |
|---|---|
queue.message.failed | queue, messageId, attempts, type (webhook deliveries) |
queue.handler.failed / queue.job.failed | handler, queue, messageId, attempts (+ tenantId, partitionKey) |
embedding.job.failed | queue, messageId, attempts, table, id |
push.fanout.failed | queue, messageId, attempts |
schedule.failed | schedule (the services/schedules file), cron, scheduledTime |
workflow.dispatch.failed | type, runId, messageId, attempts |
binding.missing | binding, kind, feature, configKey |
Exposing error details in dev / staging
By default nothing derived from the thrown error reaches the response
body — messages, cause chains, and stack frames can carry SQL, file
paths, or secrets, so they stay server-side. To get verbose bodies
while developing or staging, set EXPOSE_ERROR_STACK=1 on the worker
(wrangler.toml [vars], or wrangler secret put):
[vars]
EXPOSE_ERROR_STACK = "1"When set, the global 500 and ACTION_EXECUTION_FAILED bodies forward
the underlying error message plus details.cause (cause-chain
message), details.frames (top three stack frames with absolute paths
sanitized to basename + line number), and details.stack (the full
unsanitized stack trace). The same switch adds details.reason (the
error message) to the database fallbacks (DB_INSERT_FAILED,
DB_UPDATE_FAILED, DB_DELETE_FAILED), ACCESS_AUDIT_LOG_FAILED, the
INTERNAL_ERROR bodies of the auth handler, operator /admin/* routes,
and storage upload, presign, and confirm routes, and uses the redacted message as the TRIGGER_AFTER_FAILED error text.
Without it, none of those bodies carry anything derived from the thrown
error. With it, they still never carry a bound value — the message, cause and
stack go through the same redaction
as the server log. 1 and true turn it on; any other value leaves it off. Leave it
unset in production.
Tenant request diagnostics
With Durable Object tenancy, tenant.request.failed,
tenant.data_keys.unavailable, and tenant.rpc.failed emit structured logs.
Generated action execution failures emit action.execute.failed. Each includes
a UUID requestId, the registered route template, HTTP method, operation
stage, and up to four entries in causes. A cause contains an allowlisted
error name/code, a fixed category (such as missing_table, query_failed, or
network_connection_lost), and up to eight bundle locations. Unknown errors
retain the category unknown; arbitrary messages are never copied.
When the database names what it refused, the cause also carries subject:
the schema identifiers only, never values or SQL.
| Category | subject |
|---|---|
unique_constraint, not_null_constraint | The columns SQLite lists, e.g. ["events.id"] |
missing_table, missing_column | The table or column, e.g. ["contact_email"] |
Postgres 23xxx (integrity) | table.column and constraint from the error's fields, e.g. ["events.id", "events_pkey"] |
Each part must be a plain SQL identifier ([A-Za-z_][A-Za-z0-9_$]*, at most
63 characters, at most three dot-separated parts, at most eight entries).
Anything else drops the whole subject. The Postgres detail text, which
quotes the conflicting value, is never read.
{"level":"error","event":"action.execute.failed","stage":"execute","route":"/api/v1/events/operator/seed","method":"POST",
"causes":[{"name":"Error","category":"query_failed","frames":[]},
{"name":"Error","code":"D1_ERROR","category":"unique_constraint","subject":["events.id"],"frames":[]}]}A read whose D1 replica did not reach the client's bookmark within
bookmarkWaitMs is latency, not a
failure: the request is re-served from the primary. When a diagnostic's cause
chain contains that D1ReplicaWaitError (category replica_wait), the line is
logged at warn with event d1.replica_lag, and the event it would have been
is kept in failedEvent (for example tenant.data_keys.unavailable).
Alert on d1.replica_lag volume as a latency signal, not as an error. After
a replica wait on the data-key read, the edge skips the dump-key read for that
request (the primary retry carries it).
The edge forwards the correlation ID to the tenant and returns it in
x-request-id. Non-UUID inbound IDs are replaced for these diagnostics. Search
both Workers by that ID, then use the Worker event's deployed version to map
index.js / worker.js (or .mjs) line and column locations to source. Edge
forwarding routes may be wildcard templates; the tenant/action log identifies
the matched handler.
These diagnostics omit SQL, bound values, raw paths, queries, error messages, function names, arbitrary filenames, and credential/key material. They do not change HTTP status codes, encryption's fail-closed behavior, or retry policy. They diagnose a failure without assuming that a data-key warning necessarily caused the request to fail.
Errors by Security Layer
The status code, error code and body each security layer returns — authentication, firewall, access, guards, validation, masking, database, legacy forwards, claimed tables, tenancy.
Error Code Index
Find the page that explains an error code — runtime responses, compile errors and compiler-service refusals — by its prefix.