Skip to content
Latchkey

Earthly "target not found" / target does not exist in CI

Earthly looks up the +target you named in the Earthfile at the given path. If no target by that name exists there, or the path points at the wrong Earthfile, Earthly reports that the target does not exist.

What this error means

earthly fails immediately with "Error: target +X does not exist" or "target not found", before any build steps run.

earthly
Error: target +unit-tests does not exist
target +unit-tests not found in Earthfile ./Earthfile

Common causes

The target name is misspelled

The +target you invoked does not match any target header in the Earthfile, usually a typo or a renamed target.

Wrong path to the Earthfile

The reference points at a directory whose Earthfile does not define that target, so the lookup fails.

How to fix it

List the real targets

  1. List the targets defined in the Earthfile.
  2. Invoke the exact name, including the correct path prefix.
  3. Re-run once the reference matches a defined target.
Terminal
earthly ls
earthly ./services/api+test

Match the path to the Earthfile

Reference the target relative to the Earthfile that defines it, using the +target syntax with the correct directory.

How to prevent it

  • Use earthly ls to confirm target names before scripting them.
  • Keep target references in CI in sync with the Earthfile.
  • Reference targets by their full path prefix in a monorepo.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →