{"record":{"id":"b522a4ce6debdd38","repo":"dagger/dagger","slug":"failed-to-resolve-canonical-typedef-for-arg-q-w","errorCode":null,"errorMessage":"failed to resolve canonical typedef for arg %q: %w","messagePattern":"failed to resolve canonical typedef for arg %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/typedef.go","lineNumber":257,"sourceCode":"\t}\n\tspec.Module = module\n\tif fn.SourceMap.Valid && fn.SourceMap.Value.Self() != nil {\n\t\tspec.Directives = append(spec.Directives, fn.SourceMap.Value.Self().TypeDirective())\n\t}\n\tspec.Directives = append(spec.Directives, fn.Directives()...)\n\tfor _, arg := range fn.Args {\n\t\targSelf := arg.Self()\n\t\tmodType, ok, err := mod.ModTypeFor(ctx, argSelf.TypeDef.Self(), true)\n\t\tif err != nil {\n\t\t\treturn spec, fmt.Errorf(\"failed to get typedef for arg %q: %w\", argSelf.Name, err)\n\t\t}\n\t\tif !ok {\n\t\t\treturn spec, fmt.Errorf(\"failed to get typedef for arg %q\", argSelf.Name)\n\t\t}\n\n\t\targTypeDef, err := modType.TypeDef(ctx)\n\t\tif err != nil {\n\t\t\treturn spec, fmt.Errorf(\"failed to resolve canonical typedef for arg %q: %w\", argSelf.Name, err)\n\t\t}\n\n\t\tinput := argTypeDef.Self().ToInput()\n\t\tvar defaultVal dagql.Input\n\t\tif argSelf.DefaultValue != nil {\n\t\t\tvar val any\n\t\t\tdec := json.NewDecoder(bytes.NewReader(argSelf.DefaultValue.Bytes()))\n\t\t\tdec.UseNumber()\n\t\t\tif err := dec.Decode(&val); err != nil {\n\t\t\t\treturn spec, fmt.Errorf(\"failed to decode default value for arg %q: %w\", argSelf.Name, err)\n\t\t\t}\n\n\t\t\tvar err error\n\t\t\tdefaultVal, err = input.Decoder().DecodeInput(val)\n\t\t\tif err != nil {\n\t\t\t\treturn spec, fmt.Errorf(\"failed to decode dagql default value for arg %q: %w\", argSelf.Name, err)\n\t\t\t}\n\t\t}","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/typedef.go#L239-L275","documentation":"Raised in Function.FieldSpec (core/typedef.go:257). After obtaining a module type (modType), calling its TypeDef(ctx) to get the canonical TypeDef failed. This wraps the underlying error, prefixed with the argument name.","triggerScenarios":"modType.TypeDef(ctx) errors during schema construction, typically when the module type's definition lazily resolves to something unavailable (dependent module's type graph not loaded/corrupt).","commonSituations":"Dependency module's functions referenced as argument types while that module fails to load; engine cache corruption after upgrade; circular module references.","solutions":["Read the wrapped error for the root cause","Re-sync module dependencies (dagger mod sync / dagger develop)","Check the dependency module loads standalone (dagger functions in that module)","Clear engine cache if stale state persists (dagger engine prune)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify the dependency module loads before calling functions with its types\n_, err := dag.Module(ctx, \"other-module\")\nif err != nil { /* resolve module first */ }","typeGuard":null,"tryCatchPattern":"spec, err := fn.FieldSpec(ctx, mod)\nif err != nil {\n    var inner error\n    if errors.As(err, &inner) {\n        log.Printf(\"root cause: %v\", inner)\n    }\n    return err\n}","preventionTips":["Test dependency modules load standalone (dagger functions)","Avoid circular module references","Pin matching module dependency versions"],"tags":["dagger","modules","typedef","schema"],"backgroundTag":"typedef-resolution-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"}