Skip to content

Claude Code Action crashes with exit code 1 on PR reviews #779

@AXD-dev01

Description

@AXD-dev01

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: 7145c3e)
  • 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

- 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

{
  "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/[email protected]
  • The action worked correctly in generating PR comments on other repositories
  • This appears to be a recent regression or environment-specific issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1Showstopper bug preventing substantial subset of users from using the product, or incorrect docsprovider:1pAnthropic First-Party API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions