{"record":{"id":"c933df09a4f3415b","repo":"vitessio/vitess","slug":"error-getting-s-in-s-w","errorCode":null,"errorMessage":"error getting %s in %s: %w","messagePattern":"error getting (.+?) in (.+?): %w","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctldclient/codegen/main.go","lineNumber":79,"sourceCode":"\n\tif *out != \"\" {\n\t\tf, err := os.Create(*out)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tdefer f.Close()\n\t\toutput = f\n\t}\n\n\tpkg, err := loadPackage(*source)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tiface, err := extractSourceInterface(pkg, *typeName)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"error getting %s in %s: %w\", *typeName, *source, err))\n\t}\n\n\t// Pre-seeded imports are hardcoded in the codegen template; seeding them\n\t// here keeps them out of the generated dynamic import block.\n\timports := map[string]string{\n\t\t\"context\": \"context\",\n\t\t\"grpc\":    \"google.golang.org/grpc\",\n\t}\n\timportNames := []string{}\n\tfuncs := make(map[string]*Func, iface.NumExplicitMethods())\n\tfuncNames := make([]string, iface.NumExplicitMethods())\n\n\tfor i := 0; i < iface.NumExplicitMethods(); i++ {\n\t\tm := iface.ExplicitMethod(i)\n\t\tfuncNames[i] = m.Name()\n\n\t\tsig, ok := m.Type().(*types.Signature)\n\t\tif !ok {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctldclient/codegen/main.go#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncodegen -source go/vt/vtserverserver -type VtctldServer\n// after\ncodegen -source go/vt/vtctlservice -type VtctldServer","handlingStrategy":"validation","validationCode":"// verify the interface exists before running codegen\npkg, err := packages.Load(&packages.Config{Mode: packages.LoadSyntax}, *source)\nif err != nil || packages.PrintErrors(pkg) > 0 {\n  panic(fmt.Errorf(\"cannot load %s\", *source))\n}","typeGuard":null,"tryCatchPattern":"iface, err := extractSourceInterface(pkg, *typeName)\nif err != nil {\n  panic(fmt.Errorf(\"error getting %s in %s: %w\", *typeName, *source, err))\n}","preventionTips":["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"],"tags":["go","codegen","vtctldclient","build","reflection"],"backgroundTag":"symbol-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}