Skip to content

Claude Code exits with code 1 after starting successfully - no actual work completed #776

@julien51

Description

@julien51

Description

Claude Code GitHub Action consistently exits with code 1 after starting successfully. Claude responds to @claude mentions and posts comments, but every run fails with "Claude Code process exited with code 1" after ~300-400ms of execution, regardless of task complexity.

Environment

  • Action version: anthropics/claude-code-action@v1
  • Claude Code version: 2.0.74 (installed by action)
  • Runner: ubuntu-latest
  • Authentication: anthropic_api_key (API key from console.anthropic.com)
  • Repository type: Yarn workspaces monorepo with Astro builds

Workflow Configuration

Simplified workflow based on official example:

name: Claude Code (Simple)

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  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@v5
        with:
          fetch-depth: 0

      - name: Run Claude Code
        uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

Expected Behavior

Claude should process the task and either:

  • Complete the task successfully
  • Provide a meaningful error message if it cannot complete the task
  • Exit with code 0 on success

Actual Behavior

Every single run:

  1. ✅ Claude Code installs successfully
  2. ✅ Authentication validates
  3. ✅ Claude creates a branch (e.g., claude/issue-48-20251228-2345)
  4. ✅ Claude posts a comment: "Claude encountered an error —— I'll analyze this and get back to you."
  5. ❌ Exits with code 1 after ~300-400ms
  6. ❌ Never completes any actual work

Logs

Key excerpts from workflow run:

SDK options: {
  "systemPrompt": {
    "type": "preset",
    "preset": "claude_code"
  },
  "pathToClaudeCodeExecutable": "",
  "extraArgs": {
    "auto-approve": null
  },
  "settingSources": [
    "user",
    "project",
    "local"
  ]
}

[~2 seconds later]

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)

Statistics from run:

{
  "duration_ms": 338,
  "num_turns": 1,
  "total_cost_usd": 0,
  "permission_denials": []
}

Note: Even with show_full_output: true enabled, no actual Claude Code stderr/stdout is shown in the logs between "SDK options" and "SDK execution error".

Steps to Reproduce

  1. Set up workflow with configuration above
  2. Add valid ANTHROPIC_API_KEY to repository secrets
  3. Comment @claude <any task> on an issue
  4. Observe workflow run fails with exit code 1

Tested with various tasks:

  • Simple questions: "@claude please explain what this issue is asking for"
  • File creation: "@claude please create a simple README.md file"
  • Complex tasks: Original issue requesting domain linking analysis

All fail identically.

What We've Tried

Authentication Methods

  • claude_code_oauth_token parameter (validation error)
  • ANTHROPIC_API_KEY env var at job level (validation error)
  • CLAUDE_CODE_OAUTH_TOKEN env var at step level (empty)
  • CLAUDE_CODE_OAUTH_TOKEN env var at job level (empty)
  • anthropic_api_key input parameter (works, but exits with code 1)

Configuration Changes

  • Switched from custom OAuth token to API key
  • Simplified workflow to match official example exactly
  • Removed all custom Node.js/yarn setup steps
  • Regenerated API credentials
  • Tested on fresh issues

Debugging

  • Enabled show_full_output: true - no additional output shown
  • Checked for API authentication errors - none found
  • Tested with simple and complex tasks - all fail identically

Additional Context

The action is technically "working" in that:

  • Authentication succeeds
  • Claude responds to mentions
  • Branches are created
  • Comments are posted

But it never completes any actual work due to the immediate exit code 1.

The $0 cost in the statistics suggests Claude might not be making API calls successfully, or the run is too short to register cost.

Questions

  1. Is there a way to see the actual Claude Code CLI stdout/stderr even with show_full_output: true?
  2. Are there any known issues with exit code 1 in GitHub Actions environments?
  3. Should the action be logging more details about why Claude Code exited?

Related Issues

Similar "exit code 1" errors reported in other contexts:

However, those are different scenarios - our issue occurs on every run, not just first-time setup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:installationbugSomething 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