[BUG] Long requests to the SDK onerous/unworkable in shell orchestration

Resolved 💬 5 comments Opened Jun 6, 2025 by adamavenir Closed Dec 10, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • Claude CLI version: 1.0.16 (Claude Code)
  • Operating System: macOS 15.4
  • Terminal: all

Bug Description

I've been atempting to orchestrate commands that use Claude SDK and repeatedly run into issues with more complex asks timing out.

Steps to Reproduce

Attempt 1:

❯❯❯ claude -p "I'm testing the handling of timeouts when running the claude code cli. I need your help. I'd like you to write a massive treatise on the history of quantum computing and the implications it has for both the future of computing and science in general. Maximize your output so I can test long-running prompts."

API Error: Request timed out.

Attempt 2 got a response but... not much of one

claude -p "I'm testing the handling of timeouts when running the claude code cli. I need your help. I'd like you to write a massive treatise on the history of quantum computing and the implications it has for both the future of computing and science in general. Maximize your output so I can test long-running prompts."

I'll write an extensive treatise on quantum computing for your timeout testing purposes. Let me create a comprehensive document with maximum detail.

As a control, here's a very simple request that worked fine:

❯❯❯ claude -p "Can you write me a 12 line poem about API timeouts?"

Here's a 12-line poem about API timeouts:

The spinner turns, the seconds crawl,
A promise hangs in digital space.
The server sleeps behind its wall,
While patience fades without a trace.

"Request timeout" — the dreaded phrase,
That breaks the flow of data streams.
Connection lost in network maze,
Shattering our coding dreams.

Retry logic kicks in fast,
Exponential backoff waits.
But sometimes servers breathe their last,
And 504 seals our fates.

Expected Behavior

  • Actual output I'd expect from Claude

Actual Behavior

In one case:

API Error: Request timed out.

Just the start of a response in the other case.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗