{"record":{"id":"575eab709cda969a","repo":"vitessio/vitess","slug":"unexpected-input-type-s","errorCode":null,"errorMessage":"unexpected input type: %s","messagePattern":"unexpected input type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/tools/asthelpergen/asthelpergen.go","lineNumber":320,"sourceCode":"\t\tnewPathGen(pName, ifaceName),\n\t\tnewVisitGen(pName, ifaceName),\n\t\tnewRewriterGen(pName, ifaceName),\n\t\tnewCOWGen(pName, nt),\n\t)\n\n\tit, err := generator.GenerateCode()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn it, nil\n}\n\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)","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/tools/asthelpergen/asthelpergen.go#L302-L338","documentation":"Returned by the asthelpergen tool when it encounters an AST node input type it has no generator case for; indicates the tool needs a new case added for that type.","triggerScenarios":"Calling GenerateASTHelpers with Options.Visitable interfaces (or the generator's interface list) containing a bare type name like \"SQLNode\" instead of \"vitess.io/vitess/go/vt/sqlparser.SQLNode\".","commonSituations":"Hand-editing the Options interface list; registering a new helper generator and forgetting to fully qualify the interface name.","solutions":["Fully qualify the interface: use '<full import path>.<TypeName>'","Check how the interface string is constructed in your Options/generator registration","Add a validation that input contains a dot before calling findTypeObject"],"exampleFix":"// before\nInterfaces: []string{\"SQLNode\"}\n// after\nInterfaces: []string{\"vitess.io/vitess/go/vt/sqlparser.SQLNode\"}","handlingStrategy":"validation","validationCode":"func validateInterfaceName(s string) error {\n    if !strings.Contains(s, \".\") {\n        return fmt.Errorf(\"interface %q must be fully qualified as pkgpath.Type\", s)\n    }\n    return nil\n}","typeGuard":"func isQualifiedName(s string) bool {\n    return strings.LastIndexByte(s, '.') >= 0\n}","tryCatchPattern":null,"preventionTips":["Always list interfaces as '<full import path>.<TypeName>' in Options","Validate Options at startup/PreRun before generation","Build names programmatically from pkg path + type name instead of hand-writing strings"],"tags":["codegen","input-validation","ast-helper-gen"],"backgroundTag":"invalid-qualified-type-name","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}