Skip to content
Latchkey

Earthly "SAVE ARTIFACT ... not found" in CI

SAVE ARTIFACT exports a path from the build container to the output. If the RUN steps never produced that path, or it lives somewhere else, BuildKit cannot find it and the solve fails.

What this error means

earthly fails with "failed to solve: ... /app/dist: no such file or directory" or "artifact not found" on a SAVE ARTIFACT line.

earthly
+build | SAVE ARTIFACT /app/dist AS LOCAL ./dist
Error: solve: failed to solve: failed to compute cache key: "/app/dist": not found

Common causes

The build never created the path

A prior RUN was expected to produce the file or directory but did not, so the SAVE ARTIFACT source is missing.

Wrong working directory or path

The artifact exists under a different WORKDIR than the path you referenced, so the export path resolves to nothing.

How to fix it

Confirm the path exists in the container

  1. Add a RUN ls -la before SAVE ARTIFACT to print the directory.
  2. Correct the source path to where the build actually writes output.
  3. Re-run the target and confirm the artifact exports.
Earthfile
RUN ls -la /app/dist
SAVE ARTIFACT /app/dist AS LOCAL ./dist

Match WORKDIR to the output path

Ensure the build step and the SAVE ARTIFACT reference the same absolute path under the current WORKDIR.

How to prevent it

  • Print the output directory before saving an artifact.
  • Use absolute paths consistent with WORKDIR.
  • Fail the build step if the expected output is missing.

Frequently asked questions

What causes "Earthly "artifact not found""?
A prior RUN was expected to produce the file or directory but did not, so the SAVE ARTIFACT source is missing.
How do I fix Earthly "artifact not found"?
Confirm the path exists in the container

Related guides

References

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