-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Description
Claude Code GitHub Action consistently exits with code 1 after starting successfully. Claude responds to @claude mentions and posts comments, but every run fails with "Claude Code process exited with code 1" after ~300-400ms of execution, regardless of task complexity.
Environment
- Action version:
anthropics/claude-code-action@v1 - Claude Code version: 2.0.74 (installed by action)
- Runner:
ubuntu-latest - Authentication:
anthropic_api_key(API key from console.anthropic.com) - Repository type: Yarn workspaces monorepo with Astro builds
Workflow Configuration
Simplified workflow based on official example:
name: Claude Code (Simple)
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Run Claude Code
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}Expected Behavior
Claude should process the task and either:
- Complete the task successfully
- Provide a meaningful error message if it cannot complete the task
- Exit with code 0 on success
Actual Behavior
Every single run:
- ✅ Claude Code installs successfully
- ✅ Authentication validates
- ✅ Claude creates a branch (e.g.,
claude/issue-48-20251228-2345) - ✅ Claude posts a comment: "Claude encountered an error —— I'll analyze this and get back to you."
- ❌ Exits with code 1 after ~300-400ms
- ❌ Never completes any actual work
Logs
Key excerpts from workflow run:
SDK options: {
"systemPrompt": {
"type": "preset",
"preset": "claude_code"
},
"pathToClaudeCodeExecutable": "",
"extraArgs": {
"auto-approve": null
},
"settingSources": [
"user",
"project",
"local"
]
}
[~2 seconds later]
SDK execution error: 13243 | throw error;
13244 | }
13245 | }
13246 | getProcessExitError(code, signal) {
13247 | if (code !== 0 && code !== null) {
13248 | return new Error(`Claude Code process exited with code ${code}`);
^
error: Claude Code process exited with code 1
at getProcessExitError (/home/runner/work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:13248:14)
at exitHandler (/home/runner/work/_actions/anthropics/claude-code-action/v1/base-action/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:13373:28)
Statistics from run:
{
"duration_ms": 338,
"num_turns": 1,
"total_cost_usd": 0,
"permission_denials": []
}Note: Even with show_full_output: true enabled, no actual Claude Code stderr/stdout is shown in the logs between "SDK options" and "SDK execution error".
Steps to Reproduce
- Set up workflow with configuration above
- Add valid
ANTHROPIC_API_KEYto repository secrets - Comment
@claude <any task>on an issue - Observe workflow run fails with exit code 1
Tested with various tasks:
- Simple questions: "@claude please explain what this issue is asking for"
- File creation: "@claude please create a simple README.md file"
- Complex tasks: Original issue requesting domain linking analysis
All fail identically.
What We've Tried
Authentication Methods
- ❌
claude_code_oauth_tokenparameter (validation error) - ❌
ANTHROPIC_API_KEYenv var at job level (validation error) - ❌
CLAUDE_CODE_OAUTH_TOKENenv var at step level (empty) - ❌
CLAUDE_CODE_OAUTH_TOKENenv var at job level (empty) - ✅
anthropic_api_keyinput parameter (works, but exits with code 1)
Configuration Changes
- Switched from custom OAuth token to API key
- Simplified workflow to match official example exactly
- Removed all custom Node.js/yarn setup steps
- Regenerated API credentials
- Tested on fresh issues
Debugging
- Enabled
show_full_output: true- no additional output shown - Checked for API authentication errors - none found
- Tested with simple and complex tasks - all fail identically
Additional Context
The action is technically "working" in that:
- Authentication succeeds
- Claude responds to mentions
- Branches are created
- Comments are posted
But it never completes any actual work due to the immediate exit code 1.
The $0 cost in the statistics suggests Claude might not be making API calls successfully, or the run is too short to register cost.
Questions
- Is there a way to see the actual Claude Code CLI stdout/stderr even with
show_full_output: true? - Are there any known issues with exit code 1 in GitHub Actions environments?
- Should the action be logging more details about why Claude Code exited?
Related Issues
Similar "exit code 1" errors reported in other contexts:
- v1: App token exchange failed #522 (App token exchange failed)
- Workflow fails on first-time setup but error message says 'this is normal, ignore it' #722 (First-time setup workflow failures)
However, those are different scenarios - our issue occurs on every run, not just first-time setup.