Skip to content

fix: explain oversized system prompts#1097

Open
w3lld1 wants to merge 1 commit into
anthropics:mainfrom
w3lld1:fix/large-system-prompt-error
Open

fix: explain oversized system prompts#1097
w3lld1 wants to merge 1 commit into
anthropics:mainfrom
w3lld1:fix/large-system-prompt-error

Conversation

@w3lld1

@w3lld1 w3lld1 commented Jul 10, 2026

Copy link
Copy Markdown

Summary

  • detect oversized string system_prompt values before Linux rejects the CLI subprocess with a raw Argument list too long error
  • include the measured prompt size, platform limit, and system_prompt={"type": "file", ...} workaround in the SDK error
  • document the file-based system prompt form in ClaudeAgentOptions

Fixes #1096

Test plan

  • uv run --extra dev ruff format src/claude_agent_sdk/_internal/transport/subprocess_cli.py src/claude_agent_sdk/types.py tests/test_transport.py
  • uv run --extra dev ruff check src/claude_agent_sdk/_internal/transport/subprocess_cli.py src/claude_agent_sdk/types.py tests/test_transport.py
  • uv run --extra dev mypy src/claude_agent_sdk/_internal/transport/subprocess_cli.py src/claude_agent_sdk/types.py
  • uv run --extra dev pytest tests/test_transport.py -q

@tapheret2 tapheret2 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review notes on “fix: explain oversized system prompts”

Touched files (3): src/claude_agent_sdk/_internal/transport/subprocess_cli.py, src/claude_agent_sdk/types.py, tests/test_transport.py
Diff size (approx): +75 / -1

Observations

  • Nice that tests/fixtures are included with the change — that helps a lot for review confidence.

Questions / nits

  • Does this need a changelog / release note entry for the target version?
  • Any user-facing behavior change that should be called out in the PR body?

Thanks @w3lld1 for the contribution — left this as an independent review pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

system_prompt over 131,071 bytes dies with 'Argument list too long' before any API request

2 participants