anthropics / anthropics/claude-code-action

[Bug] Claude Code fails with exit code 1 - no meaningful error message provided

Open
#778 5 comments 3 reactions 0 assignees View on GitHub
bug dev-experience p2 provider:1p
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

**Describe the bug**
Claude Code action fails with exit code 1. The error output shows a stack trace from the SDK's error handler but doesn't provide meaningful information about what actually caused the failure.

**To Reproduce**
1. Set up workflow with `anthropics/claude-code-action@v1`
2. Trigger via `@claude` mention in an issue or PR comment
3. Action fails with exit code 1

**Expected behavior**
The action should either succeed or provide a clear error message indicating what failed (e.g., invalid token, model access issue, tool configuration error).

**Screenshots**
```
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)
at emit (node:events:92:22)
at #handleOnExit (node:child_process:511:14)
Error: Process completed with exit code 1.
```

**Workflow yml file**
```yaml
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request:
types: [opened, synchronize, ready_for_review]
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@v4
with:
fetch-depth: 1

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
model: claude-sonnet-4-20250514
max_turns: 20
allowed_tools: "Read,Write,Edit,MultiEdit,Bash(npm *),Bash(npx *),Bash(git *),mcp__github__*"
```

**API Provider**
[x] Anthropic First-Party API (default)
[ ] AWS Bedrock
[ ] GCP Vertex

**Additional context**
- The error message doesn't indicate the root cause (token issue, model access, tool config, etc.)
- Would be helpful if the action logged more details before exiting with code 1
- Possibly related: using both `allowed_tools` param and `--allowedTools` in `claude_args` might cause conflicts

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.