{"record":{"id":"84e660271d54f1c3","repo":"vitessio/vitess","slug":"no-type-called-s-found-in-s","errorCode":null,"errorMessage":"no type called '%s' found in '%s'","messagePattern":"no type called '(.+?)' found in '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/tools/asthelpergen/asthelpergen.go","lineNumber":333,"sourceCode":"\n// findTypeObject finds the types.Object for the given interface from the given scopes.\nfunc findTypeObject(interfaceToFind string, scopes map[string]*types.Scope) (types.Object, error) {\n\tpos := strings.LastIndexByte(interfaceToFind, '.')\n\tif pos < 0 {\n\t\treturn nil, fmt.Errorf(\"unexpected input type: %s\", interfaceToFind)\n\t}\n\n\tpkgname := interfaceToFind[:pos]\n\ttypename := interfaceToFind[pos+1:]\n\n\tscope := scopes[pkgname]\n\tif scope == nil {\n\t\treturn nil, fmt.Errorf(\"no scope found for type '%s'\", interfaceToFind)\n\t}\n\n\ttt := scope.Lookup(typename)\n\tif tt == nil {\n\t\treturn nil, fmt.Errorf(\"no type called '%s' found in '%s'\", typename, pkgname)\n\t}\n\treturn tt, nil\n}\n\nvar _ generatorSPI = (*astHelperGen)(nil)\n\nfunc (gen *astHelperGen) scope() *types.Scope {\n\treturn gen._scope\n}\n\nfunc (gen *astHelperGen) addType(t types.Type) {\n\tgen.todo = append(gen.todo, t)\n}\n\nfunc (gen *astHelperGen) createFiles() (map[string]*jen.File, error) {\n\tif err := gen.processTypeQueue(); err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/tools/asthelpergen/asthelpergen.go#L315-L351","documentation":"findTypeObject found the package scope but scope.Lookup(typename) returned nil, meaning no type with that exact name exists (or is exported) in that package. It throws this error naming the type and package.","triggerScenarios":"Interface name typo like 'sqlparser.SQLNod' or 'sqlparser.Visitible'; referencing a type that was renamed or removed from the package.","commonSituations":"Typo in Options.Visitable list; interface renamed during a refactor while generator config still references the old name.","solutions":["Correct the type name in Options to the exact exported identifier","Check the package source for the current name (or run `go doc <pkg>` to list types)","If the type was removed, remove or replace the corresponding generator configuration"],"exampleFix":"// before\n\"vitess.io/vitess/go/vt/sqlparser.Visitible\"\n// after\n\"vitess.io/vitess/go/vt/sqlparser.Visitable\"","handlingStrategy":"validation","validationCode":"// check the type exists before invoking codegen\nscope := scopes[pkgPath]\nif scope != nil && scope.Lookup(typeName) == nil {\n    return fmt.Errorf(\"type %s not found in %s; fix Options\", typeName, pkgPath)\n}","typeGuard":"func typeExists(scopes map[string]*types.Scope, iface string) bool {\n    i := strings.LastIndexByte(iface, '.')\n    sc := scopes[iface[:i]]\n    return sc != nil && sc.Lookup(iface[i+1:]) != nil\n}","tryCatchPattern":null,"preventionTips":["Copy interface names from source/IDE, never retype them","Grep the package for the type before adding it to Options","Update generator configuration immediately when renaming interfaces"],"tags":["codegen","scope-lookup","typo"],"backgroundTag":"type-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}