golang/go · error
internal error marshaling vet config: %v
Error message
internal error marshaling vet config: %v
What it means
Before writing vet.cfg for the vet tool, the go command serializes the vetConfig struct with json.MarshalIndent. If this fails, the error is explicitly labeled "internal error" because vetConfig holds only JSON-safe types (strings, maps, slices). It is a defensive guard for a condition that should be unreachable in practice.
Source
Thrown at src/cmd/go/internal/work/exec.go:1718
}
defer f.Close() // ignore error (can't fail)
stdout = f
}
// Cache hit: commit transaction.
a.built = vetxFile
a.FixArchive = fixArchive
if err := VetHandleStdout(stdout); err != nil {
return err // internal error (don't fall through to cachemiss)
}
return nil
}
cachemiss:
js, err := json.MarshalIndent(vcfg, "", "\t")
if err != nil {
return fmt.Errorf("internal error marshaling vet config: %v", err)
}
js = append(js, '\n')
if err := sh.writeFile(a.Objdir+"vet.cfg", js); err != nil {
return err
}
// TODO(rsc): Why do we pass $GCCGO to go vet?
env := b.cCompilerEnv()
if cfg.BuildToolchainName == "gccgo" {
env = append(env, "GCCGO="+BuildToolchain.compiler())
}
p := a.Package
tool := VetTool
if tool == "" {
panic("VetTool unset")
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Reinstall the Go toolchain
- Report as a Go bug with the package and vet flags
Defensive patterns
Strategy: validation
Prevention
- Use an official, unmodified Go toolchain
- Run `go version` to confirm the toolchain binary
- Report reproducible occurrences as Go bugs
When it happens
Trigger: Fires at the cachemiss label of the vet action builder when json.MarshalIndent(vcfg, "", "\t") returns a non-nil error.
Common situations: Should not occur; a corrupted Go installation or memory fault would be the only realistic cause.
Related errors
- marshal embedcfg: %v
- vet config not found
- %s: wrong signature for %s, %s
- action contains multiple PGO profile dependencies
- reading srcfiles list: %w
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/6a0d2d96f387e879.
Report an issue: GitHub.