{"record":{"id":"57c11a45df4580cc","repo":"JuliusBrussee/caveman","slug":"cache-replay-gemini-api-key-unavailable","errorCode":null,"errorMessage":"cache-replay: GEMINI_API_KEY unavailable","messagePattern":"cache-replay: GEMINI_API_KEY unavailable","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cmd/cache-replay/main.go","lineNumber":385,"sourceCode":"\nfunc validateProviderCredentials(records []cachebench.TraceRecord) error {\n\tproviders := map[string]bool{}\n\tfor _, record := range records {\n\t\tproviders[record.Provider] = true\n\t}\n\tfor provider := range providers {\n\t\tswitch provider {\n\t\tcase \"openai\":\n\t\t\tif os.Getenv(\"OPENAI_API_KEY\") == \"\" {\n\t\t\t\treturn errors.New(\"cache-replay: OPENAI_API_KEY unavailable\")\n\t\t\t}\n\t\tcase \"anthropic\":\n\t\t\tif os.Getenv(\"ANTHROPIC_API_KEY\") == \"\" {\n\t\t\t\treturn errors.New(\"cache-replay: ANTHROPIC_API_KEY unavailable\")\n\t\t\t}\n\t\tcase \"gemini\":\n\t\t\tif os.Getenv(\"GEMINI_API_KEY\") == \"\" {\n\t\t\t\treturn errors.New(\"cache-replay: GEMINI_API_KEY unavailable\")\n\t\t\t}\n\t\tcase \"bedrock\":\n\t\t\tif os.Getenv(\"AWS_BEARER_TOKEN_BEDROCK\") == \"\" && (os.Getenv(\"AWS_ACCESS_KEY_ID\") == \"\" || os.Getenv(\"AWS_SECRET_ACCESS_KEY\") == \"\") {\n\t\t\t\treturn errors.New(\"cache-replay: Bedrock bearer token or AWS access credentials unavailable\")\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"cache-replay: unsupported provider %q\", provider)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc verifierEnvironment(extra []string) ([]string, error) {\n\tallowed := map[string]bool{\"PATH\": true, \"LANG\": true, \"LC_ALL\": true, \"TMPDIR\": true}\n\tblocked := map[string]bool{\n\t\t\"OPENAI_API_KEY\": true, \"ANTHROPIC_API_KEY\": true, \"GEMINI_API_KEY\": true,\n\t\t\"AWS_BEARER_TOKEN_BEDROCK\": true, \"AWS_ACCESS_KEY_ID\": true, \"AWS_SECRET_ACCESS_KEY\": true, \"AWS_SESSION_TOKEN\": true,\n\t}","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cmd/cache-replay/main.go#L367-L403","documentation":"validateProviderCredentials found trace records for the 'gemini' provider but the GEMINI_API_KEY environment variable is unset/empty. Presence-only check performed before any provider request is sent.","triggerScenarios":"Thrown at cacheengine/cmd/cache-replay/main.go:385 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Export GEMINI_API_KEY in the environment running cache-replay","Remove gemini records from the trace if Gemini replay is not intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}