dagger/dagger · error
failed to load module from type defs json: %w
Error message
failed to load module from type defs json: %w
What it means
Wraps a failure to load the *core.Module object from the dagql ID derived from the typedefs JSON (dagql.NewID[*core.Module](modCallID).Load). Dagger throws this when the module produced by the SDK's moduleTypes exec cannot be resolved as a Module object in the current DAG session.
Source
Thrown at core/sdk/module_typedefs.go:158
Field: "contents",
},
)
if err != nil {
return inst, fmt.Errorf("failed to get type defs json during module sdk codegen: %w", err)
}
var modID core.ModuleID
if err = json.Unmarshal([]byte(modDefsID), &modID); err != nil {
return inst, fmt.Errorf("failed to decode module ID from type defs json: %w", err)
}
modCallID, err := modID.ID()
if err != nil {
return inst, fmt.Errorf("failed to get module ID handle from type defs json: %w", err)
}
inst, err = dagql.NewID[*core.Module](modCallID).Load(ctx, dag)
if err != nil {
return inst, fmt.Errorf("failed to load module from type defs json: %w", err)
}
if modCallID.IsHandle() {
cache, err := dagql.EngineCache(ctx)
if err != nil {
return inst, fmt.Errorf("failed to get engine cache for sdk moduleTypes dependency: %w", err)
}
if err := cache.AddExplicitDependency(ctx, ctr, inst, "sdk_module_types_generated_module"); err != nil {
return inst, fmt.Errorf("failed to retain loaded module result from sdk moduleTypes exec: %w", err)
}
}
return inst, nil
}
View on GitHub (pinned to 82ba2681db)
Solutions
- Read the wrapped cause for the underlying module load error.
- Retry the operation; check for engine/session restarts in logs.
- Verify dependency modules resolve correctly and versions match.
Defensive patterns
Strategy: retry
Try / catch
inst, err := dagql.NewID[*core.Module](modCallID).Load(ctx, dag)
if err != nil {
// check for session/engine restart; retry once
return retryLoad(ctx, modCallID)
} Prevention
- Avoid engine restarts during module dependency loads
- Keep dependency modules resolvable
- Watch for context cancellation in long operations
When it happens
Trigger: The Load of the module ID errors: the referenced module result was computed in an inaccessible scope, the ID's underlying call failed, or session/engine state no longer has the result.
Common situations: Dependency module scoping issues (module loaded across scoped sessions); engine restart mid-operation; upstream module call that produced the ID failed.
Related errors
- legacy customization constructor %v: %w
- legacy customization function %v: %w
- legacy customization object typedef: %w
- attach module source: %w
- attach module source: unexpected result %T
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/4da3ca44e0c2fca3.
Report an issue: GitHub.