{"record":{"id":"9f113ea3adffbbd4","repo":"golang/go","slug":"gocacheverify-1","errorCode":null,"errorMessage":"gocacheverify=1","messagePattern":"gocacheverify=1","errorType":"exception","errorClass":"entryNotFoundError","httpStatus":null,"severity":"info","filePath":"src/cmd/go/internal/cache/cache.go","lineNumber":155,"sourceCode":"\nconst (\n\t// action entry file is \"v1 <hex id> <hex out> <decimal size space-padded to 20 bytes> <unixnano space-padded to 20 bytes>\\n\"\n\thexSize   = HashSize * 2\n\tentrySize = 2 + 1 + hexSize + 1 + hexSize + 1 + 20 + 1 + 20 + 1\n)\n\n// verify controls whether to run the cache in verify mode.\n// In verify mode, the cache always returns errMissing from Get\n// but then double-checks in Put that the data being written\n// exactly matches any existing entry. This provides an easy\n// way to detect program behavior that would have been different\n// had the cache entry been returned from Get.\n//\n// verify is enabled by setting the environment variable\n// GODEBUG=gocacheverify=1.\nvar verify = false\n\nvar errVerifyMode = errors.New(\"gocacheverify=1\")\n\n// DebugTest is set when GODEBUG=gocachetest=1 is in the environment.\nvar DebugTest = false\n\nfunc init() { initEnv() }\n\nvar (\n\tgocacheverify = godebug.New(\"gocacheverify\")\n\tgocachehash   = godebug.New(\"gocachehash\")\n\tgocachetest   = godebug.New(\"gocachetest\")\n)\n\nfunc initEnv() {\n\tif gocacheverify.Value() == \"1\" {\n\t\tgocacheverify.IncNonDefault()\n\t\tverify = true\n\t}\n\tif gocachehash.Value() == \"1\" {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/cache/cache.go#L137-L173","documentation":"errVerifyMode ('gocacheverify=1') is a deliberate sentinel error, not a real failure. When GODEBUG=gocacheverify=1 is set, DiskCache.Get unconditionally returns errMissing wrapping errVerifyMode so that every cache lookup misses; subsequent Put calls then compare the freshly computed output against any existing entry to detect non-determinism (cases where the build would have produced a different result had the cache hit been used).","triggerScenarios":"Setting the environment variable GODEBUG=gocacheverify=1 and running any go command that uses the build cache (go build/test/install). Every Get returns this error, forcing recomputation and write-time verification.","commonSituations":"Debugging build-cache correctness during Go toolchain development; investigating suspected non-deterministic builds; accidentally leaving GODEBUG=gocacheverify=1 in a CI or shell profile, which makes all builds dramatically slower.","solutions":["If you set it intentionally, finish debugging and unset GODEBUG=gocacheverify=1 to restore normal caching.","If builds are mysteriously slow and every action rebuilds, check for a leftover GODEBUG=gocacheverify=1 in your environment.","Clear the cache (`go clean -cache`) after toggling the flag to start from a clean baseline."],"exampleFix":"// before (debug mode left on, every build recomputes)\nexport GODEBUG=gocacheverify=1\ngo build ./...\n// after\nunset GODEBUG\ngo build ./...","handlingStrategy":"validation","validationCode":"// Warn if gocacheverify is left enabled, since it disables all cache hits.\nimport \"os\"\nfunc cacheVerifyEnabled() bool {\n    return os.Getenv(\"GODEBUG\") == \"gocacheverify=1\" ||\n        strings.Contains(os.Getenv(\"GODEBUG\"), \"gocacheverify=1\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Unset GODEBUG=gocacheverify=1 after debugging determinism.","Check for stray GODEBUG settings in shell profiles and CI configs when builds are slow.","Run `go clean -cache` after toggling debug flags for a clean baseline."],"tags":["go-build","cache","godebug","determinism","debug-mode"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}