vitessio/vitess · error
no symbol found with name %s
Error message
no symbol found with name %s
What it means
extractSourceInterface looks up the interface name given on the codegen command line in the loaded package's type scope. This error means no top-level symbol with that exact name exists in the package, so the generator cannot find the source interface to mirror.
Source
Thrown at go/vt/vtctl/vtctldclient/codegen/main.go:327
for _, e := range pkg.Errors {
switch err {
case nil:
err = fmt.Errorf("errors loading package %s: %s", source, e.Error())
default:
err = fmt.Errorf("%w; %s", err, e.Error())
}
}
return nil, err
}
return pkg, nil
}
func extractSourceInterface(pkg *packages.Package, name string) (*types.Interface, error) {
obj := pkg.Types.Scope().Lookup(name)
if obj == nil {
return nil, fmt.Errorf("no symbol found with name %s", name)
}
switch t := obj.Type().(type) {
case *types.Named:
iface, ok := t.Underlying().(*types.Interface)
if !ok {
return nil, fmt.Errorf("symbol %s was not an interface but %T", name, t.Underlying())
}
return iface, nil
case *types.Interface:
return t, nil
}
return nil, fmt.Errorf("symbol %s was not an interface but %T", name, obj.Type())
}
var vitessProtoRegexp = regexp.MustCompile(`^vitess\.io.*/proto/.*`)View on GitHub (pinned to 01a25a7d17)
Solutions
- Check the name argument for typos and correct casing — Go scope lookup is case-sensitive
- Confirm the interface is declared at package level in the package passed to loadPackage
- Use grep/IDE to find the exact identifier in the target package
- Update the codegen script/Makefile target to the current interface name after a rename
Example fix
// before $ codegen --source-interface VtctldServ // no symbol found with name VtctldServ // after $ codegen --source-interface VtctldServer
Defensive patterns
Strategy: validation
Validate before calling
// Verify the interface exists before invoking codegen
if !strings.Contains(source, "type "+ifaceName+" interface {") {
return fmt.Errorf("interface %s not declared in package", ifaceName)
} Prevention
- Copy the interface name exactly, case-sensitive, from the source file
- Use the Makefile/script target rather than hand-typed arguments
- After renames, grep for the old name in codegen scripts
When it happens
Trigger: Passing a name (e.g. 'VtctldServer' or a service interface name) that is misspelled, or that does not exist as a package-level identifier in the package loaded by loadPackage.
Common situations: Renaming/refactoring the interface and forgetting to update the codegen invocation; passing a method name instead of the interface name; passing a lowercase (unexported or local) symbol that the scope lookup cannot resolve as expected; running codegen against the wrong package path.
Related errors
- error getting %s in %s: %w
- symbol %s was not an interface but %T
- package '%s' does not contain 'ast_format.go'
- generator failed for type %s: %w
- unsupported pointer type %T
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/356585b2d60cd7ea.
Report an issue: GitHub.