Skip to content
Latchkey

buildx "failed to solve: process ... did not complete successfully: exit code: 1" in CI

BuildKit ran a RUN instruction and the shell command inside it returned a non-zero status, so BuildKit aborts the build. The real failure is in the command output printed above this summary line, not in the summary itself.

What this error means

The build stops with "ERROR: failed to solve: process \"/bin/sh -c <command>\" did not complete successfully: exit code: 1". The named command is the RUN step that failed.

buildx
#12 ERROR: process "/bin/sh -c apt-get install -y libpq-dev" did not complete successfully: exit code: 1
------
ERROR: failed to solve: process "/bin/sh -c apt-get install -y libpq-dev" did not complete successfully: exit code: 1

Common causes

A command inside RUN returned non-zero

A package install, compile, or test invoked by the RUN step failed. BuildKit reports the exit code but the cause is in the step output above.

A missing dependency or stale package index

An apt-get install without a preceding apt-get update, or a package no longer in the index, makes the RUN command exit 1.

How to fix it

Read the failing RUN output above the summary

  1. Scroll up to the #<n> ERROR line that names the same command.
  2. Read the actual error the command printed (missing package, compile failure).
  3. Fix the command or its prerequisites in the Dockerfile.

Update the index before installing

Combine update and install in one RUN so the package index is fresh when the install runs.

Dockerfile
RUN apt-get update && apt-get install -y --no-install-recommends libpq-dev \
 && rm -rf /var/lib/apt/lists/*

How to prevent it

  • Run the same build locally to surface the RUN failure before pushing.
  • Combine apt-get update with installs in a single RUN.
  • Use set -eux in shell scripts so the failing line is visible.

Frequently asked questions

What causes ""process did not complete successfully: exit code: 1""?
A package install, compile, or test invoked by the RUN step failed. BuildKit reports the exit code but the cause is in the step output above.
How do I fix "process did not complete successfully: exit code: 1"?
Read the failing RUN output above the summary

Related guides

References

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