anthropics / anthropics/claude-code-action

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

Abierto
#778 5 comentarios 3 reacciones 0 asignados Ver en GitHub
bug dev-experience p2 provider:1p
Lenguaje dominante
TypeScript
Estrellas
8.9k
Forks
2.1k
Merge medio
3 d 9 h
PR fusionados (30 d)
10

Descripción

**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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.