vitessio/vitess · error
%w; %s
Error message
%w; %s
What it means
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.
Source
Thrown at go/vt/vtctl/vtctldclient/codegen/main.go:314
}, source)
if err != nil {
return nil, err
}
if len(pkgs) != 1 {
return nil, errors.New("must specify exactly one package")
}
pkg := pkgs[0]
if len(pkg.Errors) > 0 {
var err error
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)View on GitHub (pinned to 01a25a7d17)
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
Example fix
// before $ go run ./go/vt/vtctl/vtctldclient/codegen // errors loading package X: undefined: Foo; could not import bar // after $ go mod tidy && go build ./path/to/X && go run ./go/vt/vtctl/vtctldclient/codegen
Defensive patterns
Strategy: validation
Validate before calling
// Fail fast on the first underlying load error before aggregation
pkgs, err := packages.Load(cfg, pattern)
if err != nil { return err }
for _, e := range pkgs[0].Errors {
log.Printf("load error: %v", e)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: A package with several broken imports or multiple files with compile errors; vendored dependency missing causing cascading unresolved-import errors during vtctldclient codegen.
Related errors
- errors loading package %s: %s
- package '%s' does not contain 'ast_format.go'
- failed to process type %s: %w
- 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/04101c2e7ccb2881.
Report an issue: GitHub.