{"record":{"id":"2fbc66ac2992e98c","repo":"dagger/dagger","slug":"expected-s-to-be-t-but-got-t-s","errorCode":null,"errorMessage":"expected %s to be %T, but got %T (%s)","messagePattern":"expected (.+?) to be %T, but got %T \\((.+?)\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/codegen/generator/go/templates/modules.go","lineNumber":514,"sourceCode":"\t}\n\n\tps.constructor = fn\n\treturn true\n}\n\nfunc (ps *parseState) checkDaggerObjectIface(obj types.Object) (bool, error) {\n\tif obj.Name() != daggerObjectIfaceName {\n\t\treturn false, nil\n\t}\n\n\tobjType := dealias(obj.Type())\n\tnamed, isNamed := objType.(*types.Named)\n\tif !isNamed {\n\t\treturn false, fmt.Errorf(\"expected %s to be a named interface, but got %T (%s)\", daggerObjectIfaceName, obj.Type(), obj.Type().String())\n\t}\n\tiface, isIface := named.Underlying().(*types.Interface)\n\tif !isIface {\n\t\treturn false, fmt.Errorf(\"expected %s to be %T, but got %T (%s)\", daggerObjectIfaceName, &types.Interface{}, named.Underlying(), named.Underlying().String())\n\t}\n\n\tps.daggerObjectIfaceType = iface\n\treturn true, nil\n}\n\n// fillObjectFunctionCases recursively fills out the `cases` map with entries for object name -> `case` statement blocks\n// for each function in that object\nfunc (ps *parseState) fillObjectFunctionCases(type_ types.Type, cases map[string][]Code) error {\n\tvar objName string\n\tswitch x := type_.(type) {\n\tcase *types.Pointer:\n\t\treturn ps.fillObjectFunctionCases(x.Elem(), cases)\n\tcase *types.Named:\n\t\tobjName = x.Obj().Name()\n\tdefault:\n\t\treturn nil\n\t}","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/cmd/codegen/generator/go/templates/modules.go#L496-L532","documentation":"Validation in checkDaggerObjectIface: the named DaggerObject type's underlying type is not a *types.Interface. Fires when DaggerObject is declared as a struct or other non-interface named type, so it cannot serve as the required embeddable interface.","triggerScenarios":"Thrown at cmd/codegen/generator/go/templates/modules.go:514 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure DaggerObject is used as an interface, not a struct","Remove/fix custom redefinitions of DaggerObject in module code"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}