{"record":{"id":"bb632f18b834d0d6","repo":"BerriAI/litellm","slug":"cannot-pass-an-argument-containing-a-line-break-to","errorCode":null,"errorMessage":"Cannot pass an argument containing a line break to `{os.path.basename(path)}` on Windows: cmd.exe ends the command line there, so the agent would silently lose it.","messagePattern":"Cannot pass an argument containing a line break to `(.+?)` on Windows: cmd\\.exe ends the command line there, so the agent would silently lose it\\.","errorType":"exception","errorClass":"AgentRunError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/client/cli/commands/agents.py","lineNumber":194,"sourceCode":"    resolve but CreateProcess refuses to run (WinError 193), so a shim has to go\n    through the command processor. cmd.exe does not follow the C runtime quoting\n    that subprocess would apply to an argument list, and it would split on `&` or\n    `|` in a forwarded argument, so the shim case is emitted as one verbatim\n    command line with every token quoted. Every switch is load-bearing: `/s`\n    makes cmd strip only the outer pair, leaving each token quoted and its\n    metacharacters inert, `/e:on` keeps the command extensions that the percent\n    guard is built out of, `/v:off` keeps `!` from expanding, and `/d` keeps a\n    machine's AutoRun commands out of the launch. argv[0] carries the\n    caller-facing name on POSIX; Windows needs the resolved path there.\n\n    Raises AgentRunError for an argument holding a line break, which cmd would\n    read as the end of the command line and silently drop the rest of.\n    \"\"\"\n    rest: Final = tuple(args[1:])\n    if os.path.splitext(path)[1].lower() not in _WINDOWS_SHIM_SUFFIXES:\n        return (path, *rest)\n    if any(brk in token for token in rest for brk in _CMD_LINE_BREAKS):\n        raise AgentRunError(\n            f\"Cannot pass an argument containing a line break to `{os.path.basename(path)}` on \"\n            \"Windows: cmd.exe ends the command line there, so the agent would silently lose it.\"\n        )\n    inner: Final = \" \".join(_quote_for_cmd(token) for token in (path, *rest))\n    return f'cmd.exe /d /e:on /v:off /s /c \"{inner}\"'\n\n\ndef _spawn_and_wait(command: str | Sequence[str], env: Mapping[str, str]) -> int:\n    return subprocess.run(command, env=dict(env), check=False).returncode\n\n\ndef _replace_process(\n    path: str,\n    args: Sequence[str],\n    env: Mapping[str, str],\n    *,\n    execvpe: Callable[..., None] = os.execvpe,\n) -> None:","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/client/cli/commands/agents.py#L176-L212","documentation":"Windows quoting guard in the agent launcher: a forwarded argument contains a newline, which cmd.exe treats as a command-line terminator, so the agent would silently lose the remainder of its arguments; the call is rejected instead.","triggerScenarios":"Thrown at litellm/proxy/client/cli/commands/agents.py:194 when the library encounters an invalid state.","commonSituations":"An argument containing a newline was passed on Windows where cmd.exe truncates the command line.","solutions":["Remove line breaks from the argument value.","Pass multi-line content via a file instead of a command-line argument."],"exampleFix":"Replace embedded newlines with spaces before passing the argument on Windows.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}