Skip to content
Latchkey

Dagger "context canceled" in CI

"context canceled" means the operation's context was cut off before it finished. In CI this is rarely a code bug: the job timed out, the engine was OOM-killed, or the CLI lost its connection to the engine mid-run.

What this error means

dagger fails with "context canceled" or "rpc error: code = Canceled" partway through a pipeline, often after a long-running step.

dagger
Error: input: container.withExec.sync: context canceled
rpc error: code = Canceled desc = context canceled

Common causes

The CI job timed out

A job or step timeout cancels the context, aborting whatever the engine was doing at that moment.

The engine was OOM-killed or dropped

If the engine container is OOM-killed or the connection drops, in-flight operations are canceled.

How to fix it

Rule out timeouts and resources

  1. Check whether the job or step hit its timeout.
  2. Give the engine more memory so it is not OOM-killed.
  3. Read the engine logs to confirm it stayed up through the run.
Terminal
docker logs dagger-engine

Raise timeouts for long pipelines

Increase the job timeout so a long build has time to finish before the context is canceled.

.github/workflows/ci.yml
jobs:
  build:
    timeout-minutes: 45

How to prevent it

  • Set job timeouts that fit the longest pipeline.
  • Give the engine enough memory to avoid OOM cancels.
  • Keep the engine connection stable on long runs.

Frequently asked questions

What causes "Dagger "context canceled""?
A job or step timeout cancels the context, aborting whatever the engine was doing at that moment.
How do I fix Dagger "context canceled"?
Rule out timeouts and resources

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card