Repository navigation
Description
Description
Claude engine workflows fail with EHOSTUNREACH because the ANTHROPIC_API_KEY is not reaching the Claude Code CLI inside the sandbox container. The CLI reports apiKeySource: "none" at init.
Environment
gh awCLI: v0.63.0- Claude Code CLI: 2.1.81 (installed by gh-aw runtime)
- Repo: private, GitHub Teams plan
- OS: ubuntu-latest (GitHub-hosted runner)
Steps to Reproduce
- Create a simple Claude daemon spec:
---
description: "Test daemon"
strict: false
timeout-minutes: 20
on:
pull_request:
types: [opened]
engine:
id: claude
model: claude-opus-4-20250514
permissions:
contents: read
tools:
github:
toolsets: [pull_requests]
bash: true
network:
allowed: [defaults, api.anthropic.com]
---
# Test
Say hello.- Set
ANTHROPIC_API_KEYas a repo secret (confirmed viagh secret list) - Compile:
gh aw compile(succeeds, 0 errors) - Push and trigger on a PR
Expected Behavior
Claude Code CLI should receive the API key via the one-shot token mechanism and connect to api.anthropic.com.
Actual Behavior
The workflow runs through all setup steps successfully:
- ✅
Validate ANTHROPIC_API_KEY secretstep passes (✅ ANTHROPIC_API_KEY: Configured) - ✅ API proxy health check passes (
✓ Anthropic API proxy is reachable at http://172.30.0.30:10001) - ✅
ANTHROPIC_AUTH_TOKEN is placeholder value (correct) - ✅ One-shot token library copied to chroot
- ❌ Claude Code CLI reports
apiKeySource: "none"at init - ❌ All 10 API retry attempts fail with
error: "unknown" - ❌ Final error:
API Error: Unable to connect to API (EHOSTUNREACH)
Firewall logs show only 1 request to raw.githubusercontent.com — Claude Code never attempts to reach api.anthropic.com or the API proxy.
Key Log Lines
[health-check] ✓ Anthropic API proxy is reachable at http://172.30.0.30:10001
[entrypoint] One-shot token library copied to chroot at /tmp/awf-lib/one-shot-token.so
[entrypoint] Unsetting sensitive tokens from parent shell environment...
{"apiKeySource":"none","claude_code_version":"2.1.81"}
{"subtype":"api_retry","attempt":1,"error_status":null,"error":"unknown"}
...
{"text":"API Error: Unable to connect to API (EHOSTUNREACH)"}
What I've Tried
strict: true(default) — same failurestrict: false— same failurenetwork.allowed: [defaults, api.anthropic.com]— same failure- Upgraded from gh-aw v0.62.5 to v0.63.0 — same failure
- Confirmed
ANTHROPIC_API_KEYis a valid repo secret (used successfully byanthropics/claude-code-action@betain another workflow in the same repo)
Notes
The gh-aw Claude smoke test (smoke-claude.md) in this repo passes. The key difference may be that the smoke test is compiled/run within the gh-aw CI infrastructure, while our workflow is in an external private repo. The compiled lock files look structurally identical.
Activity
dduran28 commentedon Mar 24, 2026
Additional findings from extensive debugging
We've tried 5 different configurations — all fail identically with
apiKeySource: "none":network.allowed: [defaults, api.anthropic.com]engine.env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}engine.version: "2.1.52"(pinned)engine: claude(minimal, matching smoke test exactly)engine.env: ANTHROPIC_BASE_URL: http://172.30.0.30:10001+ANTHROPIC_API_KEY: placeholder-token-for-credential-isolationRoot cause identified
The entrypoint creates an
apiKeyHelperconfig:But Claude Code v2.1.81 does not pick this up — it reports
apiKeySource: "none"immediately after init. TheapiKeyHelpermechanism appears broken in the current CLI version when running inside the chroot sandbox.The sequence is:
ANTHROPIC_API_KEYfrom env ✅.claude.jsonwithapiKeyHelperpointing toget-claude-key.sh✅one-shot-token.soto chroot ✅apiKeyHelperconfig ❌apiKeySource: "none"❌Key observation
Even setting
ANTHROPIC_BASE_URLandANTHROPIC_API_KEYdirectly viaengine.envdoesn't help — the entrypoint overwrites our values with its own apiKeyHelper config regardless.Environment
npm install -g @anthropic-ai/claude-code@latest)dduran28 commentedon Mar 24, 2026
Found the likely root cause: config file path mismatch
The AWF entrypoint writes the apiKeyHelper config to:
But Claude Code v2.1.81 reads apiKeyHelper from:
These are different files. The
--bareflag docs confirm: "apiKeyHelper via --settings" — it's a settings key, not a.claude.jsonkey.In the compiled lock file, the
claudecommand is invoked as:There is NO
--settings /home/runner/.claude.jsonflag. So Claude Code never reads the apiKeyHelper config that the entrypoint wrote.The gh-aw smoke test may work because:
.claude/settings.jsonchecked into the repo with apiKeyHelper configured.claude.json(older versions may have used this path)Suggested fix: The entrypoint should either:
~/.claude/settings.jsoninstead of~/.claude.json--settings /home/runner/.claude.jsonto the claude commandfix: write apiKeyHelper to ~/.claude/settings.json for Claude Code v2…
dduran28 commentedon Mar 25, 2026
The fix in github/gh-aw-firewall#1414 is merged — thank you @lpcox!
However, the compiled lock files still reference
--image-tag 0.25.0which doesn't include the fix. The entrypoint still writes only to.claude.json:Is there an ETA for the next firewall container image release (v0.25.1 or v0.26.0) that includes this fix? We're blocked on testing 17 daemon workflows until the updated image is available.
fix: write apiKeyHelper to ~/.claude/settings.json for Claude Code v2…
lpcox commentedon Mar 26, 2026
@dduran28 the latest gh-aw (v0.64.1) should link to awf v0.25.1 that includes the fix. please try it an let me know if it works!