Skip to content

fix: clear error when system_prompt hits OS argv length limit#1098

Open
tapheret2 wants to merge 1 commit into
anthropics:mainfrom
tapheret2:fix/system-prompt-arg-too-long-error
Open

fix: clear error when system_prompt hits OS argv length limit#1098
tapheret2 wants to merge 1 commit into
anthropics:mainfrom
tapheret2:fix/system-prompt-arg-too-long-error

Conversation

@tapheret2

Copy link
Copy Markdown

Summary

When system_prompt is a large string, Linux fails at execve with "Argument list too long" (per-argv MAX_ARG_STRLEN = 32 * PAGE_SIZE) before any API request.

This PR checks the encoded size against the platform limit (via os.sysconf("SC_PAGE_SIZE") when available) and raises CLIConnectionError that:

  • names system_prompt
  • reports measured size and the limit
  • points to the working file form: system_prompt={"type": "file", "path": "..."}

Windows / platforms without sysconf skip the preflight (the OS limit does not apply the same way).

Closes #1096

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

1 participant