vitessio/vitess · error
'%s' has changed
Error message
'%s' has changed
What it means
VerifyFilesOnDisk compares the formatted generated bytes with the file on disk via bytes.Equal. When they differ, it reports that the file has changed, i.e. the checked-in generated code is stale relative to what the generators would produce.
Source
Thrown at go/tools/asthelpergen/asthelpergen.go:239
// VerifyFilesOnDisk compares the generated results from the codegen against the files that
// currently exist on disk and returns any mismatches
func VerifyFilesOnDisk(result map[string]*jen.File) (errors []error) {
for fullPath, file := range result {
existing, err := os.ReadFile(fullPath)
if err != nil {
errors = append(errors, fmt.Errorf("missing file on disk: %s (%w)", fullPath, err))
continue
}
genFile, err := codegen.FormatJenFile(file)
if err != nil {
errors = append(errors, fmt.Errorf("goimport error: %w", err))
continue
}
if !bytes.Equal(existing, genFile) {
errors = append(errors, fmt.Errorf("'%s' has changed", fullPath))
continue
}
}
return errors
}
// Options configures the AST helper generation process.
type Options struct {
// Packages specifies the Go packages to analyze for AST types.
// Can be package paths like "./mypackage" or import paths like "github.com/example/ast".
Packages []string
// RootInterface is the fully qualified name of the root interface that all AST nodes implement.
// Format: "package.path.InterfaceName" (e.g., "github.com/example/ast.Node")
RootInterface string
// Clone configures the clone generator options
Clone CloneOptionsView on GitHub (pinned to 01a25a7d17)
Solutions
- Run `asthelpergen` (or `make codegen`) to regenerate and commit the updated files
- Check `git diff` after regeneration to review the intended changes
- Add `make codegen` to your pre-commit workflow so generated files never go stale
Example fix
// before $ asthelpergen verify // 'go/vt/sqlparser/ast_clone.go' has changed // after $ make codegen && asthelpergen verify
Defensive patterns
Strategy: validation
Validate before calling
cmd := exec.Command("asthelpergen")
if err := cmd.Run(); err != nil {
return fmt.Errorf("regenerate code before verifying: %w", err)
} Prevention
- Make `make codegen` part of your pre-commit routine
- Add a CI job that runs codegen and fails on diff
- Review git diff after regeneration to catch unintended churn
When it happens
Trigger: Modifying AST types or generator logic (e.g. adding a field to a struct, changing sql.y, editing generator templates) and running verify without first regenerating; committed code out of sync with `make codegen` output.
Common situations: CI verification failing after a PR touched AST definitions or generators; a developer forgot to run codegen after editing sqlparser types.
Related errors
- missing file on disk: %s (%w)
- CopySchemaShard was not successful because the schemas betwe
- must specify exactly one package
- package '%s' does not contain 'ast_format.go'
- interface %s implemented by %s (%s as %T) without ptr
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/d867728a8a67973c.
Report an issue: GitHub.