Skip to content

Mixed LF/CRLF SSE delimiters prevent Claude Code tool calls

Quick fix

Fix SSE delimiter parsing to recognize mixed LF/CRLF blank-line delimiters and preserve Claude Code tool-call events.

Error output
No `tool_use` block is produced.

`take_sse_block` recognizes only `\n\n` and `\r\n\r\n`, not `\n\r\n`, where the data line ends with LF and the blank line with CRLF. A complete SSE event is therefore not split immediately; when later events arrive, multiple events may also be merged into one block.

On the path converting OpenAI Chat Completions SSE to Anthropic SSE, this prevents a complete tool call containing the tool name, ID, argument fragments, and `finish_reason: "tool_calls"` from producing a `tool_use` block.

  1. Add `\n\r\n` and `\r\n\n` to the shared SSE delimiter list in `take_sse_block`, and continue selecting the earliest complete delimiter.

  2. Add framing tests for all four LF/CRLF delimiter combinations and transport chunks, plus a Chat Completions-to-Anthropic tool-call regression test.

ToolClaude Code
Version3.20.4(受影响)
PlatformsWindows

(No FAQ yet)

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.