[BUG] include_partial_messages unreliable with ClaudeSDKClient (streaming input mode)
Resolved 💬 2 comments Opened Jan 13, 2026 by fohara Closed Feb 27, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using ClaudeSDKClient from the Python SDK with include_partial_messages=True, StreamEvent objects are either never yielded or yielded unreliably (related to #15055).
Documentation inconsistency: The CLI help states:
--include-partial-messages Include partial message chunks as they arrive
(only works with --print and --output-format=stream-json)
However, ClaudeSDKClient operates in streaming input mode (--input-format stream-json) rather than --print mode. This suggests --include-partial-messages should have no effect when using ClaudeSDKClient, yet #15055 shows StreamEvent objects ARE sometimes returned.
The issue: It's unclear whether:
- The CLI help text is outdated and the flag DOES work in streaming input mode
- The flag is intended to work but has reliability issues
- The flag is not supposed to work in streaming input mode (and any StreamEvents received are incidental)
Steps to Reproduce
import asyncio
from claude_agent_sdk import ClaudeSDKClient
from claude_agent_sdk.types import ClaudeAgentOptions, StreamEvent
async def main():
options = ClaudeAgentOptions(
include_partial_messages=True,
permission_mode="bypassPermissions",
)
async with ClaudeSDKClient(options) as client:
await client.query("Count from 1 to 5, one number per line")
stream_event_count = 0
async for message in client.receive_response():
if isinstance(message, StreamEvent):
stream_event_count += 1
print(f"StreamEvent: {message.event.get('type', 'unknown')}")
else:
print(f"Message type: {type(message).__name__}")
print(f"\nTotal StreamEvents received: {stream_event_count}")
asyncio.run(main())
Expected: StreamEvent objects should be consistently yielded when include_partial_messages=True.
Actual: Zero StreamEvent objects received in some/all runs.
What Should Happen?
- The CLI documentation should clarify whether
--include-partial-messagesis supported in streaming input mode (--input-format stream-json) - If supported,
StreamEventobjects should be reliably yielded - If not supported, the SDK should either warn users or not pass the flag in streaming mode
Environment
- Claude Code version: 2.1.5
- claude-agent-sdk version: 0.1.18
- Platform: macOS
- Python: 3.13
Related Issues
- #15055 - Shows 20-70% of concurrent sessions fail to receive
StreamEventobjects
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗