Skip to content

Gemini engine fails with AWF proxy: GEMINI_API_BASE_URL points to proxy but proxy has no Gemini handler #25294

Closed

Description

@arthurfvives

Description

When using engine: gemini in a workflow, the run fails with exit code 41:

Please set an Auth method in your /home/runner/.gemini/settings.json or specify 
one of the following environment variables before running: GEMINI_API_KEY, 
GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_GENAI_USE_GCA

The secret GEMINI_API_KEY is correctly configured as a repository secret
(visible as *** in the logs).

Root cause

The AWF infrastructure sets GEMINI_API_BASE_URL to http://host.docker.internal:10003
(the AWF API proxy), but the proxy reports no Gemini support:

[INFO] API proxy enabled: OpenAI=false, Anthropic=false, Copilot=false
[WARN] ⚠️  API proxy enabled but no API keys found in environment

The Gemini CLI receives GEMINI_API_BASE_URL pointing to a proxy that doesn't
understand the Gemini protocol. It then fails to authenticate, even though
GEMINI_API_KEY is set in the environment.

Steps to reproduce

  1. Add GEMINI_API_KEY as a repository Actions secret
  2. Install a workflow with engine: gemini
  3. Trigger the workflow

Activity

  1. dbrattli commented on Apr 15, 2026

    @dbrattli

    v0.68.3 partially fixes this — proxy handles Gemini routing but doesn't inject the real key

    After upgrading to v0.68.3 (which includes the fix from gh-aw-firewall#1944), the exit code 41 issue is resolved and the proxy now correctly reports Gemini=true:

    [INFO] API proxy enabled: OpenAI=false, Anthropic=false, Copilot=false, Gemini=true
    --gemini-api-target generativelanguage.googleapis.com
    

    However, the run now fails with API_KEY_INVALID (exit code 144) instead:

    _ApiError: {"error":{"code":400,"message":"API key not valid. Please pass a valid API key.",
    "status":"INVALID_ARGUMENT","reason":"API_KEY_INVALID"}}
    

    The GEMINI_API_KEY secret is confirmed valid — calling generativelanguage.googleapis.com directly with the key works fine. The issue appears to be that the placeholder GEMINI_API_KEY injected into the agent container (per the fix) is being forwarded to Google as-is, rather than being substituted with the real key by the proxy sidecar before the request leaves the sandbox.

    So the fix resolved the routing half of the problem but the key injection half still isn't working.

  2. locked and limited conversation to collaborators on Apr 15, 2026
  3. unlocked this conversation on Apr 15, 2026
  4. lpcox commented on Apr 16, 2026

    @lpcox
    Collaborator

    Fixed in gh-aw-firewall by PR github/gh-aw-firewall#1995 (Gemini credential isolation) and #1944 (GEMINI_API_BASE_URL). Closing tracking issue github/gh-aw-firewall#2009.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions