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 CloneOptions

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Run `asthelpergen` (or `make codegen`) to regenerate and commit the updated files
  2. Check `git diff` after regeneration to review the intended changes
  3. 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

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


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/d867728a8a67973c. Report an issue: GitHub.