-
Notifications
You must be signed in to change notification settings - Fork 518
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
problem is at line 175
claude-agent-sdk-python/src/claude_agent_sdk/_internal/transport/subprocess_cli.py
Line 175 in 67e77e9
| cmd.extend(["--agents", json.dumps(agents_dict)]) |
and windows cmd max length is 8191.
error log in console:
PS > uv run .\xxxx.py
命令行太长。
Fatal error in message reader: Command failed with exit code 1 (exit code: 1)
Error output: Check stderr output for detailsand this is the monkey patch by claude code
from claude_agent_sdk._internal.transport.subprocess_cli import SubprocessCLITransport
_original_build_command = SubprocessCLITransport._build_command
def _patched_build_command(self):
cmd = _original_build_command(self)
if '--agents' in cmd:
idx = cmd.index('--agents')
if idx + 1 < len(cmd):
agents_json = cmd[idx + 1]
temp_file = tempfile.NamedTemporaryFile(
mode='w',
suffix='.json',
delete=False,
encoding='utf-8'
)
temp_file.write(agents_json)
temp_file.close()
cmd[idx + 1] = f"@{temp_file.name}"
return cmd
SubprocessCLITransport._build_command = _patched_build_command
print("[Windows Workaround] Applied monkey patch to fix 'command line too long' issue")dingyifei
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working