golang/go · error

vet config not found

Error message

vet config not found

What it means

When vetting a package, the go tool reads a.Deps[0].vetCfg, the vet configuration produced by the package's build action. If the build did not fail (a.Deps[0].Failed == nil) yet vetCfg is nil, this fires. The accompanying comment states vet config should only be missing when the build failed, so reaching this branch implies an internal inconsistency in action-graph construction.

Source

Thrown at src/cmd/go/internal/work/exec.go:1583

// -{vet,fix}tool) were set explicitly on the command line.
var VetExplicit bool

func (b *Builder) vet(ctx context.Context, a *Action) error {
	// a.Deps[0] is the build of the package being vetted.

	a.Failed = nil // vet of dependency may have failed but we can still succeed

	if a.Deps[0].Failed != nil {
		// The build of the package has failed. Skip vet check.
		// Vet could return export data for non-typecheck errors,
		// but we ignore it because the package cannot be compiled.
		return nil
	}

	vcfg := a.Deps[0].vetCfg
	if vcfg == nil {
		// Vet config should only be missing if the build failed.
		return fmt.Errorf("vet config not found")
	}

	sh := b.Shell(a)

	// We use "vet" terminology even when building action graphs for go fix.
	vcfg.VetxOnly = a.VetxOnly
	vcfg.VetxOutput = a.Objdir + "vet.out"
	vcfg.Stdout = a.Objdir + "vet.stdout"
	if a.needFix {
		vcfg.FixArchive = a.Objdir + "vet.fix.zip"
	}
	vcfg.PackageVetx = make(map[string]string)

	h := cache.NewHash("vet " + a.Package.ImportPath)
	fmt.Fprintf(h, "vet %q\n", b.toolID("vet"))

	vetFlags := VetFlags

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Run `go vet -x <pkg>` to trace action execution
  2. Run `go build <pkg>` separately to confirm the build itself succeeds
  3. Report as a Go bug with the package path and build flags
Defensive patterns

Strategy: validation

Validate before calling

// Build the package first to surface the real failure before vet
if err := exec.Command("go", "build", pkg).Run(); err != nil {
    return err // build failure is the root cause
}

Prevention

When it happens

Trigger: Fires in the vet action builder after the `if a.Deps[0].Failed != nil` early return, when a.Deps[0].vetCfg == nil.

Common situations: Internal toolchain bug, or unusual packages (assembly-only, packages with no Go files) where vet config is not produced. Very rare in normal use.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/bb5ac9b5665dcabf. Report an issue: GitHub.