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 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.
Terminal
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.
Terminal
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.
Related guides
Dagger "function not found" in CIFix Dagger "function ... not found" in CI - the function you called is not exposed by the loaded module, ofte…
Dagger "input:" GraphQL error in CIFix Dagger "Error: input: ..." GraphQL errors in CI - the engine rejected a query, usually a bad field, argum…
Dagger CLI/engine "incompatible version" in CIFix Dagger "incompatible" CLI/engine version errors in CI - the CLI or SDK version does not match the engine…