Self-Healing CI: Missing System Packages and Setup Gaps
When a build fails because a system package or tool is missing, the fix is mechanical: install it - and, ideally, bake it into the setup so it never recurs.
The problem
A step fails with command not found or a missing shared library. The code is fine; the runner just does not have a required tool or -dev package installed. A human adds an install step and the build passes.
./build.sh: line 12: cmake: command not found
# or
error while loading shared libraries: libGL.so.1: cannot open shared object fileWhy it happens
Builds often assume tools that are present locally but absent on a clean runner. Native extensions in particular need -dev headers and shared libraries that are not installed by default.
The gap is deterministic - it fails every time until the dependency is provided - but it is mechanical, not a bug in your code.
The manual fix
The manual fix is to install the missing dependency, then make it permanent:
- Identify the missing command or library from the error.
- Install it (e.g.
apt-get install -y <package>). - Add the install to your workflow or runner image so future runs have it.
sudo apt-get update && sudo apt-get install -y cmake libgl1How this gets automated
Because the missing piece is named in the error and the remedy is a well-scoped install, this can be automated safely from a curated allowlist of known-safe packages. A self-healing pipeline installs the missing dependency, retries the step, and can propose a durable change to your setup so the gap is closed for good - turning a recurring red build into a one-time, permanent fix.