anthropics / anthropics/claude-code-action

Claude Code Action crashes with exit code 1 on PR reviews

Đang mở
#779 14 bình luận 13 reaction 0 người được giao Xem trên GitHub
bug p1 provider:1p
Ngôn ngữ chính
TypeScript
Star
8.9k
Fork
2.1k
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
10

Mô tả

# Claude Code Action Crash Report

## Issue Summary
The `anthropics/claude-code-action@v1` is consistently crashing with exit code 1 approximately 2 seconds after starting, preventing PR security reviews from completing.

## Environment
- **Action Version**: `anthropics/claude-code-action@v1` (SHA: 7145c3e0510bcdbdd29f67cc4a8c1958f1acfa2f)
- **Runner**: `ubuntu-latest` (Ubuntu 24.04.3 LTS)
- **Event**: `pull_request` (opened, synchronize, reopened)
- **Repository**: AXD-enterprise/axd-hub (private)
- **Date**: December 30, 2025

## Configuration
```yaml
- name: Claude Code Security Review
uses: anthropics/claude-code-action@v1
with:
prompt: |
Review this PR for security issues and code quality...
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: |
--system-prompt "..."
--max-turns 10
--model claude-sonnet-4-5
--mcp-config .claude/mcp-config.json
```

## Observed Behavior
1. ✅ Authentication succeeds (OIDC token exchange works)
2. ✅ Claude Code SDK initializes
3. ✅ Settings file created at `/home/runner/.claude/settings.json`
4. ✅ Prompt file created at `/home/runner/work/_temp/claude-prompts/claude-prompt.txt`
5. ❌ **Claude Code process exits with code 1 after ~2 seconds**
6. ❌ No PR comments posted
7. ❌ No detailed error message in logs

## Error Output
```
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)
at emit (node:events:92:22)
at #handleOnExit (node:child_process:511:14)
```

## SDK Options Used
```json
{
"systemPrompt": {
"type": "preset",
"preset": "claude_code"
},
"pathToClaudeCodeExecutable": "",
"extraArgs": {
"system-prompt": "...",
"max-turns": "10",
"model": "claude-sonnet-4-5",
"mcp-config": ".claude/mcp-config.json"
},
"settingSources": ["user", "project", "local"]
}
```

## Troubleshooting Steps Taken
1. ✅ Verified `ANTHROPIC_API_KEY` secret exists and is valid
2. ✅ Corrected model name from invalid `claude-sonnet-4-5-20250929` to valid `claude-sonnet-4-5`
3. ✅ Ensured workflow file matches between PR and main branch
4. ✅ Verified MCP config file exists at `.claude/mcp-config.json`
5. ✅ Enabled `show_full_output: true` (still no additional error details)
6. ✅ Confirmed authentication works (OIDC token exchange successful)

## Expected Behavior
Claude Code should:
1. Analyze the PR changes
2. Post review comments on specific lines
3. Complete with exit code 0 (or appropriate non-zero if issues found but commented)

## Actual Behavior
Claude Code crashes immediately without:
- Posting any comments
- Providing detailed error messages
- Indicating what caused the failure

## Impact
- Unable to use automated Claude security reviews
- PRs blocked by failed required check
- Manual security review required as workaround

## Workaround Applied
Merged PR manually after verifying security issues were addressed through other means.

## Related Workflow Runs
- Run ID: 20601268576 (initial failure)
- Run ID: 20602080944 (after model name fix)
- Run ID: 20602966122 (after auth fix)
- Run ID: 20603048271 (with full output enabled)
- Run ID: 20603165965 (after workflow file sync)

All runs show identical crash pattern.

## Request
Please investigate why the Claude Code process is exiting with code 1 immediately after initialization without providing actionable error messages.

## Additional Context
- Using `@anthropic-ai/claude-agent-sdk@0.1.74`
- The action worked correctly in generating PR comments on other repositories
- This appears to be a recent regression or environment-specific issue

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.