dagger/dagger · error
failed to call sdk module codegen: %w
Error message
failed to call sdk module codegen: %w
What it means
Dagger wraps any error returned by the dagql Select call that invokes the SDK module's own `codegen` function (e.g. the Go/Python/TypeScript SDK runtime). The wrapped error contains the SDK runtime's own failure — typically a crash, compilation error, or unimplemented function inside the SDK runtime container.
Source
Thrown at core/sdk/module_code_generator.go:64
return nil, fmt.Errorf("failed to get schema introspection json ID during %s module sdk codegen: %w", sdk.mod.mod.Self().Name(), err)
}
var inst dagql.Result[*core.GeneratedCode]
err = dag.Select(ctx, sdkInst.sdk, &inst, dagql.Selector{
Field: "codegen",
Args: []dagql.NamedInput{
{
Name: "modSource",
Value: dagql.NewID[*core.ModuleSource](sourceID),
},
{
Name: "introspectionJson",
Value: dagql.NewID[*core.File](schemaJSONFileID),
},
},
})
if err != nil {
return nil, fmt.Errorf("failed to call sdk module codegen: %w", err)
}
return inst.Self(), nil
}
View on GitHub (pinned to 82ba2681db)
Solutions
- Read the wrapped inner error for the SDK runtime's actual failure message
- Verify the SDK runtime image can be pulled (network/registry access)
- Ensure your module's dagger.json sdk field matches a supported SDK version
- Run `dagger develop` after fixing to regenerate bindings
Example fix
// before: dagger.json
{"sdk": "python"}
// after: pin a concrete supported version
{"sdk": "python"} // ensure engine supports this SDK; update engine if not Defensive patterns
Strategy: try-catch
Validate before calling
// shell: ensure registry/network reachability for SDK runtime image
dagger query <<'EOF' || echo 'check engine connectivity'
{version}
EOF Try / catch
// Go client
_, err := src.GeneratedCode(ctx)
if err != nil {
var pe *connect.PostError // or inspect message
log.Printf("SDK runtime codegen failed: %v — inspect inner SDK error", err)
return err
} Prevention
- Always read the wrapped inner error — the SDK runtime's message names the real problem
- Ensure network/registry access for SDK runtime images
- Keep the sdk field in dagger.json supported by your engine version
- Re-run `dagger develop` after module layout changes
When it happens
Trigger: Calling Codegen where the SDK runtime module's `codegen` field errors: the runtime image cannot be pulled, the generated code fails to compile inside the runtime, or the runtime returns a user-facing error.
Common situations: No network access to pull the SDK runtime image; incompatible module source layout for the SDK version; template files in the SDK failing to render; codegen script in the runtime failing.
Related errors
- unknown type %q
- enum types must be named
- failed to find decl for object %s: %w
- failed to find decl for named type %s: %w
- failed to find decl for method %s: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/92611051d3eb998a.
Report an issue: GitHub.