{"record":{"id":"6a0d2d96f387e879","repo":"golang/go","slug":"internal-error-marshaling-vet-config-v","errorCode":null,"errorMessage":"internal error marshaling vet config: %v","messagePattern":"internal error marshaling vet config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/work/exec.go","lineNumber":1718,"sourceCode":"\t\t\t}\n\t\t\tdefer f.Close() // ignore error (can't fail)\n\t\t\tstdout = f\n\t\t}\n\n\t\t// Cache hit: commit transaction.\n\t\ta.built = vetxFile\n\t\ta.FixArchive = fixArchive\n\t\tif err := VetHandleStdout(stdout); err != nil {\n\t\t\treturn err // internal error (don't fall through to cachemiss)\n\t\t}\n\n\t\treturn nil\n\t}\ncachemiss:\n\n\tjs, err := json.MarshalIndent(vcfg, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"internal error marshaling vet config: %v\", err)\n\t}\n\tjs = append(js, '\\n')\n\tif err := sh.writeFile(a.Objdir+\"vet.cfg\", js); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(rsc): Why do we pass $GCCGO to go vet?\n\tenv := b.cCompilerEnv()\n\tif cfg.BuildToolchainName == \"gccgo\" {\n\t\tenv = append(env, \"GCCGO=\"+BuildToolchain.compiler())\n\t}\n\n\tp := a.Package\n\ttool := VetTool\n\tif tool == \"\" {\n\t\tpanic(\"VetTool unset\")\n\t}\n","sourceCodeStart":1700,"sourceCodeEnd":1736,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/work/exec.go#L1700-L1736","documentation":"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.","triggerScenarios":"Fires at the cachemiss label of the vet action builder when json.MarshalIndent(vcfg, \"\", \"\\t\") returns a non-nil error.","commonSituations":"Should not occur; a corrupted Go installation or memory fault would be the only realistic cause.","solutions":["Reinstall the Go toolchain","Report as a Go bug with the package and vet flags"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use an official, unmodified Go toolchain","Run `go version` to confirm the toolchain binary","Report reproducible occurrences as Go bugs"],"tags":["go-toolchain","vet","json-marshal","internal-error"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}