{"record":{"id":"323d6d16a7259951","repo":"dagger/dagger","slug":"t-converttosdkinput-unknown-type-t","errorCode":null,"errorMessage":"%T.ConvertToSDKInput: unknown type %T","messagePattern":"%T\\.ConvertToSDKInput: unknown type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/coremod.go","lineNumber":828,"sourceCode":"\nfunc (obj *CoreModObject) ConvertToSDKInput(ctx context.Context, value dagql.Typed) (any, error) {\n\tif value == nil {\n\t\treturn nil, nil\n\t}\n\tswitch x := value.(type) {\n\tcase dagql.Input:\n\t\treturn x, nil\n\tcase dagql.AnyResult:\n\t\tid, err := x.ID()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif id == nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn id.Encode()\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%T.ConvertToSDKInput: unknown type %T\", obj, value)\n\t}\n}\n\nfunc (obj *CoreModObject) CollectContent(ctx context.Context, value dagql.AnyResult, content *core.CollectedContent) error {\n\tif value == nil {\n\t\tif err := content.CollectJSONable(nil); err != nil {\n\t\t\treturn fmt.Errorf(\"collect_jsonable nil core object %q: %w\", obj.name, err)\n\t\t}\n\t\treturn nil\n\t}\n\tswitch x := value.(type) {\n\tcase dagql.Input:\n\t\tif err := content.CollectJSONable(x); err != nil {\n\t\t\treturn fmt.Errorf(\"collect_jsonable input core object %q (%T): %w\", obj.name, x, err)\n\t\t}\n\t\treturn nil\n\tcase dagql.AnyResult:\n\t\tid, err := x.ID()","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/coremod.go#L810-L846","documentation":"ConvertToSDKInput converts a dagql value into a plain SDK input (usually an encoded ID string). If the value is neither a dagql.Input nor a dagql.AnyResult, the type is unknown to this CoreModObject and the error \"%T.ConvertToSDKInput: unknown type %T\" is returned. This is an internal type-contract violation for core object types.","triggerScenarios":"Passing a value that is neither a dagql.Input nor dagql.AnyResult (e.g. a raw struct, string, or wrong Typed wrapper) into ConvertToSDKInput for a core object type like Container or Directory.","commonSituations":"Custom SDK generators or module tooling feeding mis-typed values through the mod-type conversion layer; forked Dagger code passing wrong wrappers; schema changes introducing new Typed kinds not handled by the switch.","solutions":["Wrap the value as a dagql result/input before conversion — pass the dagql.AnyResult obtained from a query select.","If you control the code, add a case for the new dagql.Typed type in the switch in ConvertToSDKInput.","Check the %T in the message to identify which concrete type leaked in and fix where it was produced.","Upgrade Dagger so the conversion layer supports the type introduced by your SDK version."],"exampleFix":"// before\nin, err := obj.ConvertToSDKInput(ctx, myPlainContainerStruct)\n\n// after\nres := dagql.NewResultForCurrentCall(ctx, ctrTyped) // dagql.AnyResult\nin, err := obj.ConvertToSDKInput(ctx, res)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isConvertibleSDKInput(v dagql.Typed) bool {\n\tswitch v.(type) {\n\tcase dagql.Input, dagql.AnyResult, nil:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","tryCatchPattern":"in, err := obj.ConvertToSDKInput(ctx, value)\nif err != nil {\n\tif strings.Contains(err.Error(), \"unknown type\") {\n\t\treturn fmt.Errorf(\"value of type %T must be a dagql Input or AnyResult\", value)\n\t}\n\treturn err\n}","preventionTips":["Only pass values obtained from dagql selects/results into conversion APIs","Assert the concrete dagql.Typed type before conversion","Update conversion switches when new dagql.Typed kinds are introduced"],"tags":["dagger","type-conversion","dagql"],"backgroundTag":"unknown-type-conversion","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"}