dagger/dagger · error
failed to call sdk moduleTypes: %w
Error message
failed to call sdk moduleTypes: %w
What it means
This error wraps any failure from the dagql Select call that invokes the SDK runtime's `moduleTypes` field to build a container for generating module type definitions. It is thrown by the dagger engine's core/sdk package during `ModuleTypes`, the phase where a module's SDK runtime container is called to emit /module-typedefs.json. The underlying %w error carries the real cause (SDK function resolution, GraphQL field error, etc.).
Source
Thrown at core/sdk/module_typedefs.go:96
Field: "moduleTypes",
Args: []dagql.NamedInput{
{
Name: "modSource",
Value: dagql.NewID[*core.ModuleSource](sourceID),
},
{
Name: "introspectionJson",
Value: dagql.NewID[*core.File](schemaJSONFileID),
},
{
Name: "outputFilePath",
Value: dagql.NewString(moduleIDPath),
},
},
},
)
if err != nil {
return inst, fmt.Errorf("failed to call sdk moduleTypes: %w", err)
}
hideCtx := dagql.WithSkip(ctx)
err = dag.Select(hideCtx, ctr, &ctr,
dagql.Selector{
Field: "withExec",
Args: []dagql.NamedInput{
{Name: "args", Value: dagql.ArrayInput[dagql.String]{}},
{Name: "useEntrypoint", Value: dagql.NewBoolean(true)},
{Name: "experimentalPrivilegedNesting", Value: dagql.NewBoolean(true)},
{Name: "execMD", Value: dagql.NewDigestedSerializedString(&execMD, moduleTypesExecMDDigest)},
{Name: "moduleContext", Value: dagql.Opt(moduleContextID)},
},
},
)
if err != nil {
return inst, fmt.Errorf("failed to execute sdk moduleTypes container: %w", err)
}View on GitHub (pinned to 82ba2681db)
Solutions
- Read the wrapped %w cause to find the real failure (SDK runtime error, image pull, invalid source).
- Verify the module's source (dir/ref) is valid and reachable.
- Upgrade the dagger CLI/engine and module SDK dependencies to matching versions.
- Re-run with debug logging / telemetry to see the failing nested span.
Defensive patterns
Strategy: try-catch
Validate before calling
// Go caller: ensure source and deps are valid before invoking module operations
if src == nil || deps == nil {
return fmt.Errorf("module source and schema deps must be initialized before codegen")
} Try / catch
inst, err := sdkInst.ModuleTypes(ctx, deps, source, mod)
if err != nil {
var gqlErr * dagql.QueryError // inspect wrapped cause
return fmt.Errorf("module sdk moduleTypes call failed: %w", err)
} Prevention
- Keep dagger CLI and engine versions in sync
- Pin SDK module dependency versions
- Validate module source refs before codegen
- Capture full error chains (%w) when diagnosing
When it happens
Trigger: The dag.Select on sdkInst.sdk with Field "moduleTypes" (args modSource, introspectionJson, outputFilePath) returns an error — e.g. the SDK runtime image cannot be resolved, the sdk module failed to initialize, or the underlying GraphQL query errored.
Common situations: A module's SDK runtime (e.g. the Go/Python/TS SDK module) has a bug or incompatible version; the source repository or ref cannot be resolved; the engine cannot serve the introspection JSON ID; network failure pulling the SDK base image.
Related errors
- attach generated code directory: unexpected result %T
- apply changes to workspace root: %w
- namespace interface function id: %w
- namespace interface typedef id: %w
- persisted module source sdk does not implement code generato
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/bbcf1ffcebc4c108.
Report an issue: GitHub.