Surfaced by a role-based review; verified against current code.
Problem: When the /inference proxy exhausts all models, the server emits data: {"error": "..."} (server/internalApiEndpointServerHook.ts sendSseError). The client (client/modules/textGenerationWithInternalApi.ts:96) blindly reads parsedLine.choices[0].delta.content on every frame — an error frame has no .choices, so it throws TypeError and the real error the server sent never reaches the user or the logs.
Fix: In processStreamResponse, detect parsedLine.error and throw a ChatGenerationError with that message; guard choices?.[0]?.delta?.content. Add a test feeding an error frame.
Files: client/modules/textGenerationWithInternalApi.ts
Surfaced by a role-based review; verified against current code.
Problem: When the
/inferenceproxy exhausts all models, the server emitsdata: {"error": "..."}(server/internalApiEndpointServerHook.tssendSseError). The client (client/modules/textGenerationWithInternalApi.ts:96) blindly readsparsedLine.choices[0].delta.contenton every frame — an error frame has no.choices, so it throwsTypeErrorand the real error the server sent never reaches the user or the logs.Fix: In
processStreamResponse, detectparsedLine.errorand throw aChatGenerationErrorwith that message; guardchoices?.[0]?.delta?.content. Add a test feeding an error frame.Files:
client/modules/textGenerationWithInternalApi.ts