Skip to content

[BUG] Claude CLI returns empty output with large stdin input in headless mode #7263

Description

@geomna

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Claude CLI in headless mode (-p flag) returns empty output when processing large stdin input (~7000+ characters), while smaller inputs (~2500 characters) work correctly.

What Should Happen?

Claude CLI should process large text input and return analysis results.

Error Messages/Logs

- Command exits with return code 0 (success)
- Empty stdout output (0 characters)
- No stderr errors
- `--verbose` flag provides no additional information

Steps to Reproduce

  1. Create a test file with ~7000 characters of content
  2. Run: cat testfile.txt | claude -p --verbose --append-system-prompt "Analyze this content" --output-format text
  3. Observe empty output despite successful exit code

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

1.0.108

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Non-interactive/CI environment

Additional Information

Test Results

  • Input size ~2350 characters: Returns expected output (1904 characters)
  • Input size ~6986 characters: Returns empty output (0 characters)
  • Both cases: exit code 0, no stderr errors

Impact
This prevents using Claude CLI for processing large documents, code reviews, or batch text analysis in automated workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions