vitessio/vitess · error
unexpected input type: %s
Error message
unexpected input type: %s
What it means
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.
Source
Thrown at go/tools/asthelpergen/asthelpergen.go:320
newPathGen(pName, ifaceName),
newVisitGen(pName, ifaceName),
newRewriterGen(pName, ifaceName),
newCOWGen(pName, nt),
)
it, err := generator.GenerateCode()
if err != nil {
return nil, err
}
return it, nil
}
// findTypeObject finds the types.Object for the given interface from the given scopes.
func findTypeObject(interfaceToFind string, scopes map[string]*types.Scope) (types.Object, error) {
pos := strings.LastIndexByte(interfaceToFind, '.')
if pos < 0 {
return nil, fmt.Errorf("unexpected input type: %s", interfaceToFind)
}
pkgname := interfaceToFind[:pos]
typename := interfaceToFind[pos+1:]
scope := scopes[pkgname]
if scope == nil {
return nil, fmt.Errorf("no scope found for type '%s'", interfaceToFind)
}
tt := scope.Lookup(typename)
if tt == nil {
return nil, fmt.Errorf("no type called '%s' found in '%s'", typename, pkgname)
}
return tt, nil
}
var _ generatorSPI = (*astHelperGen)(nil)View on GitHub (pinned to 01a25a7d17)
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
Example fix
// before
Interfaces: []string{"SQLNode"}
// after
Interfaces: []string{"vitess.io/vitess/go/vt/sqlparser.SQLNode"} Defensive patterns
Strategy: validation
Validate before calling
func validateInterfaceName(s string) error {
if !strings.Contains(s, ".") {
return fmt.Errorf("interface %q must be fully qualified as pkgpath.Type", s)
}
return nil
} Type guard
func isQualifiedName(s string) bool {
return strings.LastIndexByte(s, '.') >= 0
} Prevention
- 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
When it happens
Trigger: 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".
Common situations: Hand-editing the Options interface list; registering a new helper generator and forgetting to fully qualify the interface name.
Related errors
- interface %s implemented by %s (%s as %T) without ptr
- sample is too small
- BaseKeyspace is required for SNAPSHOT keyspaces
- must specify exactly one package
- package '%s' does not contain 'ast_format.go'
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/575eab709cda969a.
Report an issue: GitHub.