anthropics / anthropics/claude-code-action

Intermittent SDK crash on PR review - exits with code 1 after ~150ms with $0 cost

Open
#853 17 comments 17 reactions 0 assignees View on GitHub
bug p1 provider:1p
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

## Description

The Claude Code Review workflow intermittently crashes almost immediately after initialization, before making any API calls.

## Error Pattern

```
{
"type": "result",
"subtype": "success",
"is_error": true,
"duration_ms": 158,
"num_turns": 1,
"total_cost_usd": 0,
"permission_denials": []
}

error: Claude Code process exited with code 1
at $ (.../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:19:7668)
```

Key observations:
- **duration_ms: ~150-180ms** - crashes almost instantly
- **total_cost_usd: 0** - no API calls were made
- **permission_denials: []** - not a permissions issue
- Model initializes successfully: `"model": "claude-sonnet-4-5-20250929"`

## Intermittent Nature

Same workflow, same configuration - some PRs succeed, others fail:

| Time | PR Type | Result | Duration |
|------|---------|--------|----------|
| 09:35 | Human PR | ✅ Success | 1m52s |
| 07:46 | Human PR | ✅ Success | 1m43s |
| 10:57 | Dependabot PR | ❌ Fail | 21s |
| 12:11 | Human PR | ❌ Fail | 33s |

Re-running the failed workflow produces the same failure.

## Workflow Configuration

```yaml
- name: Run Claude Code Review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Please review this PR...
claude_args: |
--allowed-tools "mcp__github__get_pull_request,mcp__github__get_pull_request_files,mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff"
```

## Environment

- Runner: `ubuntu-latest`
- Action version: `anthropics/claude-code-action@v1`
- API key: Confirmed valid (works on other PRs in same repo)

## Expected Behavior

Workflow should either succeed or fail with a meaningful error message.

## Actual Behavior

SDK crashes with minified JavaScript stack trace, no clear error message about root cause.

## Questions

1. Is there a known issue with certain PR content triggering this?
2. Would pinning to a specific version help?
3. Is there additional debug logging we can enable?

Thanks!

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.