Skip to content

Stream error payloads crash when code is non-numeric #132

@saxon134

Description

@saxon134

error_from_stream_payload() converts error.get("code") with int(...). The rest of the SDK treats error.code as a string code, and stream error frames can carry symbolic codes; in that case iter_sse_models()/aiter_sse_models() raise ValueError instead of GlobalRouterError. A minimal reproducer is an SSE frame like data: {"error":{"code":"rate_limit_error","message":"limited"}}, which reaches this line and fails during int conversion.

File: src/globalrouter/_errors.py

Line: 69

Severity: medium

Summary: int cast of stream error code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions