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.
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 1Common 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
- Confirm dagger.json exists at the module root.
- Run dagger from that directory, or pass the module path with -m.
- Fix any build error reported for the module source.
dagger -m ./ci call buildRebuild the module to surface source errors
Develop the module locally so a source or dependency error appears before CI runs it.
dagger developHow 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.