Troubleshooting Managed Workers
Fix adapter image, packaging, deployment, and runtime problems in managed Workers.
For problems that apply to every Worker, such as CLI access, image pushes, and deployment readiness, see the general Troubleshooting page. Keep the Worker ID, template version, adapter version, and the failing command or invocation ID in your notes.
The Adapter Image Cannot Be Pulled
docker pull or a FROM line fails with unauthorized, denied, or no basic auth credentials.
- Sign in again with
ctxl config login. Then runctxl workers configure-docker --pretty. - Check that
docker-credential-ctxlis on yourPATH. - Check the image name and version against Get the Runtime Adapters. Adapter images are under
images.contextual.io/worker/base/.
If the pull still fails, contact Contextual support and include the image reference, tenant ID, and error.
Copying the Library Fails with Permission Denied
Docker created the .contextual directory as root before the copy ran. Remove it, create it yourself with mkdir -p .contextual, and run the copy command again.
If an upgraded library still shows old methods, the new copy was nested inside the old directory. Delete the old copy and copy again, as Get the Runtime Adapters shows.
package Refuses the Release
The package command refuses an output directory that already exists. Remove .worker-image before you package again.
The command also checks worker.json before it writes anything. Check that:
workerIdis lowercase words joined by hyphens, andversionis a semantic version.- Each handler name starts with a letter and lists
event,http, orcron. configSchemais an object.- For TypeScript,
entrypointnames the.cjsbundle in the build output directory. For Python, it names a.pyfile insrc,main.pyby default. - For Rust and Go, the second argument is the compiled
linux/amd64binary. - The build output directory has no symbolic links.
Saving the Worker Fails
The platform checks a managed Worker's image and bindings when you save it:
- "A managed host must depend on exactly one release-labelled application":
IMAGEisn't the.worker-imagebuild thatpackageproduced. An image built straight from your source has no release label. - "Worker connection bindings must match the application's declared connections exactly":
CONNECTION_BINDINGSmust bind exactly the aliases inworker.json'sconnections. - A refused environment variable: names that start with
CONTEXTUAL_are reserved.
The Worker Does Not Become Ready
-
Open Workers > your Worker > Deployment in the admin console and check both containers. A managed Worker runs an
appcontainer, your code, and ahostcontainer. -
Read each container's output. Add
--previousto read the run before a restart:Terminalctxl workers logs <worker-id> -c app --config-id <config-id> ctxl workers logs <worker-id> -c host --config-id <config-id> ctxl workers logs <worker-id> -c host --previous --config-id <config-id> -
Check for these common causes:
- The handler name does not match.
HANDLERmust name a handler inworker.jsonthat accepts the template's trigger. CONFIGisn't a JSON object, or, for TypeScript, doesn't matchconfigSchema. The TypeScript adapter checks the schema at startup. In Rust, Go, and Python, a missing value shows up as your handler's own error instead.- The name or version does not match. The name and version in your code must match
worker.jsonin every language: the default export in TypeScript, andCargo.toml's version in Rust. - The start hook takes longer than 60 seconds. The host stops waiting for
startafter 60 seconds. Move slow setup into the handler, or make it lazy. PLATFORM_SERVICESis invalid. The host does not start when a name in the option isn't a valid service name (letters and digits only), or when it grantsconnectionsApi. The host's output names the problem.
- The handler name does not match.
A Capability Call Fails
Read the failure's code and reason:
| Code | What to Check |
|---|---|
validation |
The parameters. issues names each invalid one. |
authorization |
The record type, connection, or attachment access. Records, attachments, and AI Search use the tenant's managed native-object-api connection. Check that connection's access to the requested object type. AI generation, AI uploads, tool sessions, and loading bound connections use the Worker's own OAuth client. For a failed call, inspect its error details. A 401 or 403 alone does not establish which permission or configuration needs changing. If the failure remains unresolved and appears to involve the Worker's managed credentials or permissions, follow Worker Identity to contact Contextual support with the relevant details. api-configuration records are always refused through generic record operations. For services.request, also check the failure's reason; see Refusals. |
not-found |
The type, record, attachment, Route, or AI Search profile ID |
conflict |
The record changed after you read its hash. Read it again. |
effect-outcome-unknown |
A write may have happened. Check before you retry. |
deadline |
The call ran out of its own time, such as an AI generation's timeoutMs, 300 seconds by default. An HTTP request past HTTP_TIMEOUT_MS is a 504 response instead. |
platform |
The platform or a provider failed or was busy. Retry only if retryable is true. |
contract |
The host does not offer the operation (unsupported-method) or is not configured for it (configuration). Check that the template version matches your adapter version. See Release Versions. |
A host fault is different: the host failed the call itself, or the bridge to it was lost. It is a CapabilityError in Rust, Go, and Python, or a plain Error in TypeScript, and it fails the invocation even if your code catches it.
HTTP Requests Fail with 400, 413, 500, 503, or 504
- 400: The request body ended before its declared length.
- 413: The request body is larger than
BODY_SIZE_LIMIT. - 500: The handler failed, or returned an invalid response: a status outside 200 to 599, an unknown field, or a body over 4 MiB. Read the
appcontainer's output. - 503: All of the replica's request slots were in use for longer than
HTTP_ADMISSION_TIMEOUT_MS, or its queue was full. The response hasRetry-After: 1. Add replicas, or raiseHTTP_CONCURRENCYorHTTP_QUEUE_CAPACITY. Their sum must stay at most 101, or the host does not start. A replica that is shutting down also answers 503. - 504: The request passed
HTTP_TIMEOUT_MS. Raise the deadline for slow operations, such as large attachment transfers or long AI generations. The effective limit is the lowest of every limit on the path: a long transfer can also be cut off by intermediate connections, even withinHTTP_TIMEOUT_MS. Prefer short requests, and move long work to an event Worker.
Events Are Processed More Than Once, or the Worker Keeps Restarting
Delivery is at least once. An unhandled handler failure stops the host without acknowledging the event, the container restarts, and the event is redelivered. The same happens if the replica stops before the event is acknowledged, or if an event's payload is not JSON or is larger than 8 MiB. There is no dead-letter queue, so an event that always fails makes the Worker restart repeatedly.
An idle app that doesn't answer the host also causes a restart. The host pings the app every 10 seconds and ends the connection after 30 seconds without an answer while the app is idle. Before each event or scheduled run, the app must answer within 5 seconds, or the host fails that event or run without sending it to the app. A handler that is running is not held to these checks, so a long call or a handler that blocks its event loop is fine up to the execution deadline.
Read the failure with ctxl workers logs <worker-id> -c host --previous. Make writes safe to repeat, using the event's id as the idempotency key. Catch failures that retrying cannot fix, log them, and return successfully.
Logs Are Missing
The logger's entries go to the tenant log pipeline only when the tenant has its own contextual/logs topic. Read them with ctxl logs <worker-id>. The host always writes them to its own container output too, with the console logger's lines: ctxl workers logs <worker-id> -c host. Entries below the host's minimum level, info by default, are dropped. Output your code prints goes to the app container: ctxl workers logs <worker-id> -c app.