vitessio/vitess · error
error getting %s in %s: %w
Error message
error getting %s in %s: %w
What it means
This error comes from the vtctldclient code generator tool: after parsing the source package, extractSourceInterface failed to locate/extract the requested interface (flag -type) in the given -source package. main() immediately panics with the wrapped message naming the type and source. It blocks client stub generation, so no new vtctldclient code is produced.
Source
Thrown at go/vt/vtctl/vtctldclient/codegen/main.go:79
if *out != "" {
f, err := os.Create(*out)
if err != nil {
panic(err)
}
defer f.Close()
output = f
}
pkg, err := loadPackage(*source)
if err != nil {
panic(err)
}
iface, err := extractSourceInterface(pkg, *typeName)
if err != nil {
panic(fmt.Errorf("error getting %s in %s: %w", *typeName, *source, err))
}
// Pre-seeded imports are hardcoded in the codegen template; seeding them
// here keeps them out of the generated dynamic import block.
imports := map[string]string{
"context": "context",
"grpc": "google.golang.org/grpc",
}
importNames := []string{}
funcs := make(map[string]*Func, iface.NumExplicitMethods())
funcNames := make([]string, iface.NumExplicitMethods())
for i := 0; i < iface.NumExplicitMethods(); i++ {
m := iface.ExplicitMethod(i)
funcNames[i] = m.Name()
sig, ok := m.Type().(*types.Signature)
if !ok {View on GitHub (pinned to 01a25a7d17)
Solutions
- Verify the -type flag matches the exact interface name defined in the -source package
- Fix the -source path so it points at the package containing the interface
- Run codegen via the Makefile target (make codegen) so correct flags are used
- If the interface was moved/renamed, update the codegen invocation in the build scripts
Example fix
// before codegen -source go/vt/vtserverserver -type VtctldServer // after codegen -source go/vt/vtctlservice -type VtctldServer
Defensive patterns
Strategy: validation
Validate before calling
// verify the interface exists before running codegen
pkg, err := packages.Load(&packages.Config{Mode: packages.LoadSyntax}, *source)
if err != nil || packages.PrintErrors(pkg) > 0 {
panic(fmt.Errorf("cannot load %s", *source))
} Try / catch
iface, err := extractSourceInterface(pkg, *typeName)
if err != nil {
panic(fmt.Errorf("error getting %s in %s: %w", *typeName, *source, err))
} Prevention
- Run codegen only via make codegen so flags stay correct
- Update -source/-type flags immediately when the interface moves
- Grep for the interface name in the source package before regenerating
When it happens
Trigger: Running go/vt/vtctl/vtctldclient/codegen with -source/-type flags where the named interface does not exist in the parsed package, the package fails to load, or the path/type name is misspelled.
Common situations: Renaming or moving the VtctldServer interface without updating codegen flags; running make codegen from a directory where the source path no longer resolves; type moved to another package after refactor.
Related errors
- found %d error(s) when loading Go packages: %s
- errors loading package %s: %s
- no symbol found with name %s
- symbol %s was not an interface but %T
- package '%s' does not contain 'ast_format.go'
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/c933df09a4f3415b.
Report an issue: GitHub.