{"record":{"id":"92611051d3eb998a","repo":"dagger/dagger","slug":"failed-to-call-sdk-module-codegen-w","errorCode":null,"errorMessage":"failed to call sdk module codegen: %w","messagePattern":"failed to call sdk module codegen: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/sdk/module_code_generator.go","lineNumber":64,"sourceCode":"\t\treturn nil, fmt.Errorf(\"failed to get schema introspection json ID during %s module sdk codegen: %w\", sdk.mod.mod.Self().Name(), err)\n\t}\n\n\tvar inst dagql.Result[*core.GeneratedCode]\n\terr = dag.Select(ctx, sdkInst.sdk, &inst, dagql.Selector{\n\t\tField: \"codegen\",\n\t\tArgs: []dagql.NamedInput{\n\t\t\t{\n\t\t\t\tName:  \"modSource\",\n\t\t\t\tValue: dagql.NewID[*core.ModuleSource](sourceID),\n\t\t\t},\n\t\t\t{\n\t\t\t\tName:  \"introspectionJson\",\n\t\t\t\tValue: dagql.NewID[*core.File](schemaJSONFileID),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to call sdk module codegen: %w\", err)\n\t}\n\treturn inst.Self(), nil\n}\n","sourceCodeStart":46,"sourceCodeEnd":68,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/sdk/module_code_generator.go#L46-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: dagger.json\n{\"sdk\": \"python\"}\n// after: pin a concrete supported version\n{\"sdk\": \"python\"}  // ensure engine supports this SDK; update engine if not","handlingStrategy":"try-catch","validationCode":"// shell: ensure registry/network reachability for SDK runtime image\ndagger query <<'EOF' || echo 'check engine connectivity'\n{version}\nEOF","typeGuard":null,"tryCatchPattern":"// Go client\n_, err := src.GeneratedCode(ctx)\nif err != nil {\n    var pe *connect.PostError // or inspect message\n    log.Printf(\"SDK runtime codegen failed: %v — inspect inner SDK error\", err)\n    return err\n}","preventionTips":["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"],"tags":["codegen","sdk-runtime","dagger"],"backgroundTag":"sdk-codegen-invocation-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}