Skip to content
Latchkey

Dagger "failed to load module" / dagger.json in CI

Dagger reads dagger.json to locate and build your module before calling its functions. If the file is missing, the working directory is wrong, or the module source fails to build, loading aborts before any function runs.

What this error means

dagger fails with "failed to load module" or "dagger.json not found", or a module build error, before it can call a function.

dagger
Error: failed to load module: dagger.json not found in current directory or any parent
Error: failed to load module: failed to build module: exit code 1

Common causes

No dagger.json in the working directory

The CLI walks up looking for dagger.json. If the step runs outside the module root, or the file is absent, loading fails.

The module source failed to build

A compile or dependency error in the module code stops the engine from producing the module to call functions on.

How to fix it

Run from the module root or pass -m

  1. Confirm dagger.json exists at the module root.
  2. Run dagger from that directory, or pass the module path with -m.
  3. Fix any build error reported for the module source.
Terminal
dagger -m ./ci call build

Rebuild the module to surface source errors

Develop the module locally so a source or dependency error appears before CI runs it.

Terminal
dagger develop

How to prevent it

  • Run dagger from the module root or pass -m explicitly.
  • Keep dagger.json committed at the module root.
  • Build the module locally before pushing.

Related guides

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