Docker "failed to solve: no active session" (BuildKit) in CI
buildx opens a session with buildkitd to stream the build context, secrets, SSH, and registry auth. If that session is gone when the solve needs it - a dropped connection, a recycled builder, or a daemon that restarted - BuildKit fails with no active session. It is usually a transient session/connection failure, not a Dockerfile bug.
What this error means
A docker buildx build fails with failed to solve: no active session for <session-id>. A re-run on a fresh builder typically succeeds.
ERROR: failed to solve: no active session for 9f3c2a1b-7d4e-4c2a-a1b2-c3d4e5f60718Common causes
The buildx session dropped before the solve
A connection blip between buildx and buildkitd loses the session that carries context and secrets.
The builder was recycled mid-build
An ephemeral builder torn down during the job kills the active session.
A stale or misconfigured builder
A buildx builder pointed at a buildkitd that restarted no longer has a live session.
How to fix it
Re-run the build
- This error is usually transient - retry the job.
- If it clears on retry, treat it as a session/connection blip.
docker buildx build -t myorg/api:1.4.2 --push .Recreate and bootstrap the builder
- Remove the stale builder and create a fresh persistent one.
- Bootstrap it so a live session is established before the build.
docker buildx rm ci || true
docker buildx create --name ci --driver docker-container --bootstrap --useHow to prevent it
- Use a persistent, bootstrapped builder per job.
- Avoid recycling the builder while a build is in flight.
- Retry transient session failures before deeper debugging.