{"record":{"id":"04101c2e7ccb2881","repo":"vitessio/vitess","slug":"w-s-04101c","errorCode":null,"errorMessage":"%w; %s","messagePattern":"%w; %s","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctldclient/codegen/main.go","lineNumber":314,"sourceCode":"\t}, source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(pkgs) != 1 {\n\t\treturn nil, errors.New(\"must specify exactly one package\")\n\t}\n\n\tpkg := pkgs[0]\n\tif len(pkg.Errors) > 0 {\n\t\tvar err error\n\n\t\tfor _, e := range pkg.Errors {\n\t\t\tswitch err {\n\t\t\tcase nil:\n\t\t\t\terr = fmt.Errorf(\"errors loading package %s: %s\", source, e.Error())\n\t\t\tdefault:\n\t\t\t\terr = fmt.Errorf(\"%w; %s\", err, e.Error())\n\t\t\t}\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn pkg, nil\n}\n\nfunc extractSourceInterface(pkg *packages.Package, name string) (*types.Interface, error) {\n\tobj := pkg.Types.Scope().Lookup(name)\n\tif obj == nil {\n\t\treturn nil, fmt.Errorf(\"no symbol found with name %s\", name)\n\t}\n\n\tswitch t := obj.Type().(type) {\n\tcase *types.Named:\n\t\tiface, ok := t.Underlying().(*types.Interface)","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctldclient/codegen/main.go#L296-L332","documentation":"This is the continuation/second variant of the package-load error aggregation in loadPackage: once a first load error exists, subsequent errors are appended with %w; %s so the returned error wraps the whole chain and supports errors.Is/Unwrap. It carries the same meaning as error 1080 — the target package failed to load with multiple errors.","triggerScenarios":"Same as 1080: packages.Load returns pkg with len(pkg.Errors) > 0 and more than one load error, so the loop takes the default branch appending each error to the accumulated one.","commonSituations":"A package with several broken imports or multiple files with compile errors; vendored dependency missing causing cascading unresolved-import errors during vtctldclient codegen.","solutions":["Read the joined sub-errors after '; %s' — fix each underlying compile/import error it lists","Run 'go vet' or 'go build' on the package to see errors with file positions","Run 'go mod tidy' and re-run the codegen tool"],"exampleFix":"// before\n$ go run ./go/vt/vtctl/vtctldclient/codegen\n// errors loading package X: undefined: Foo; could not import bar\n// after\n$ go mod tidy && go build ./path/to/X && go run ./go/vt/vtctl/vtctldclient/codegen\n","handlingStrategy":"validation","validationCode":"// Fail fast on the first underlying load error before aggregation\npkgs, err := packages.Load(cfg, pattern)\nif err != nil { return err }\nfor _, e := range pkgs[0].Errors {\n    log.Printf(\"load error: %v\", e)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read all sub-errors after the '; ' separators — fix each one","Keep generated proto code in sync (make proto)","Avoid running codegen with uncommitted half-finished edits in the target package"],"tags":["go","codegen","error-wrapping","package-loading"],"backgroundTag":"package-load-failure","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}