anthropics / anthropics/claude-code-action

Claude Code Action crashes with exit code 1 on PR reviews

Ouverte
#779 14 commentaires 13 réactions 0 personnes assignées Voir sur GitHub
bug p1 provider:1p
Langage dominant
TypeScript
Étoiles
8.9k
Forks
2.1k
Merge moyen
3 j 9 h
PR mergées (30 j)
10

Description

# 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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.