Skip to content

fix: surface internal API stream errors - #2212

Merged
felladrin merged 1 commit into
felladrin:mainfrom
snowyukitty:fix/internal-api-error-frames
Jul 24, 2026
Merged

fix: surface internal API stream errors#2212
felladrin merged 1 commit into
felladrin:mainfrom
snowyukitty:fix/internal-api-error-frames

Conversation

@snowyukitty

Copy link
Copy Markdown
Contributor

Description

Fixes #2176.

When the /inference proxy exhausts its models, it sends an SSE frame with an
error field and no choices. The client previously dereferenced
choices[0] for every parsed frame, replacing the useful server message with a
TypeError.

This change:

  • throws ChatGenerationError with the server-provided message for string
    error frames;
  • safely skips choice-less and non-content frames; and
  • adds focused regression coverage for both behaviors.

The normal content path is unchanged. Chunk-boundary buffering tracked in
#2177 remains outside this patch.

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Other (refactor, build, chore)

Checklist

  • npm run lint passes
  • Tests pass (npm run test), with tests added where it made sense
Security, performance, or breaking changes? Expand if relevant.

None. The patch changes only client-side handling of an existing server error
frame and adds no new API, dependency, or migration requirement.

@felladrin
felladrin merged commit 49a8b48 into felladrin:main Jul 24, 2026
3 checks passed
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.

Internal-API stream: error frames crash the client instead of showing the message

2 participants