You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: gemini API key rejected by proxy sidecar despite valid key #25944
engine: gemini — API key rejected by proxy sidecar despite valid key
When using engine: gemini in an agentic workflow, the Gemini API returns API_KEY_INVALID even though the key is valid and confirmed working via direct curl requests.
Evidence
The validation step passes: ✅ GEMINI_API_KEY: Configured
Direct curl to generativelanguage.googleapis.com with the same key succeeds and returns model data
The workflow fails immediately with:
API key not valid. Please pass a valid API key.
status: INVALID_ARGUMENT
Proxy configuration from logs
[INFO] API proxy enabled: OpenAI=false, Anthropic=false, Copilot=false, Gemini=true
The lock file routes Gemini calls through the proxy sidecar:
The API proxy sidecar at host.docker.internal:10003 appears to not be forwarding the API key correctly to generativelanguage.googleapis.com, or is stripping/modifying it in transit.
Reproduction
Create a workflow with engine: gemini
Add a valid GEMINI_API_KEY as a repo secret
Run the workflow — validation passes but agent execution fails with API_KEY_INVALID
changed the title [-]engine: gemini — API key rejected by proxy sidecar despite valid key[/-][+]bug: gemini API key rejected by proxy sidecar despite valid key[/+]on Apr 12, 2026
Confirming this is still broken on v0.69.0 / firewall image 0.25.25.
What we've verified:
GEMINI_API_KEY secret is correctly set and confirmed valid — direct curl to generativelanguage.googleapis.com with the key succeeds
Upgrading through v0.68.1 → v0.68.3 → v0.68.7 → v0.69.0 and recompiling each time does not fix it
The proxy now correctly reports Gemini=true (fixed in v0.68.3), but the key is still rejected by Google with API_KEY_INVALID
What we see in logs:
[INFO] API proxy enabled: OpenAI=false, Anthropic=false, Copilot=false, Gemini=true
[INFO] API proxy sidecar enabled - API keys will be held securely in sidecar container
...
_ApiError: {"error":{"code":400,"message":"API key not valid. Please pass a valid API key.","status":"INVALID_ARGUMENT","reason":"API_KEY_INVALID"}}
Our interpretation: the proxy sidecar receives the request but forwards a placeholder key to Google rather than substituting the real GEMINI_API_KEY. The fix in gh-aw-firewall#1944 resolved the routing half (CLI now reaches Google) but the key injection half is still not working.
API proxy sidecar enabled - API keys will be held securely in sidecar container
--image-tag 0.25.26
But still:
_ApiError: {"error":{"code":400,"message":"API key not valid. Please pass a valid API key.","status":"INVALID_ARGUMENT","reason":"API_KEY_INVALID"}}
The fix in gh-aw-firewall#1995 addresses stripping the placeholder header/query-param and injecting the real key — but the proxy sidecar may not be receiving GEMINI_API_KEY in its environment at all. The in-container pre-flight health check only checks ANTHROPIC_BASE_URL, OPENAI_BASE_URL, and COPILOT_API_URL — there's no equivalent Gemini health check, so failures are silent until the first real API call.
Activity
[-]engine: gemini — API key rejected by proxy sidecar despite valid key[/-][+]bug: gemini API key rejected by proxy sidecar despite valid key[/+]dbrattli commentedon Apr 21, 2026
Confirming this is still broken on v0.69.0 / firewall image
0.25.25.What we've verified:
GEMINI_API_KEYsecret is correctly set and confirmed valid — direct curl togenerativelanguage.googleapis.comwith the key succeedsGemini=true(fixed in v0.68.3), but the key is still rejected by Google withAPI_KEY_INVALIDWhat we see in logs:
Our interpretation: the proxy sidecar receives the request but forwards a placeholder key to Google rather than substituting the real
GEMINI_API_KEY. The fix in gh-aw-firewall#1944 resolved the routing half (CLI now reaches Google) but the key injection half is still not working.dbrattli commentedon Apr 22, 2026
Update: still broken on firewall image 0.25.26
PR gh-aw-firewall#1995 was merged on 2026-04-15 and shipped in v0.69.3 (firewall image
0.25.26). We upgraded and just ran the workflow — same result.Run: https://github.com/cognitedata/cognite-function-apps/actions/runs/24777513108/job/72499620442
Log confirms:
API proxy enabled: Gemini=trueGEMINI_API_BASE_URL: http://host.docker.internal:10003API proxy sidecar enabled - API keys will be held securely in sidecar container--image-tag 0.25.26But still:
The fix in gh-aw-firewall#1995 addresses stripping the placeholder header/query-param and injecting the real key — but the proxy sidecar may not be receiving
GEMINI_API_KEYin its environment at all. The in-container pre-flight health check only checksANTHROPIC_BASE_URL,OPENAI_BASE_URL, andCOPILOT_API_URL— there's no equivalent Gemini health check, so failures are silent until the first real API call.lpcox commentedon Apr 23, 2026
🔗 AWF tracking issue: https://github.com/github/gh-aw-firewall/issues/github/gh-aw-firewall#2173
lpcox commentedon Apr 29, 2026
🔗 AWF tracking issue: https://github.com/github/gh-aw-firewall/issues/github/gh-aw-firewall#2291
lpcox commentedon Apr 29, 2026
The Gemini API key forwarding issue was addressed in gh-aw-firewall by:
Included in firewall v0.25.29+.