Skip to content

bug: errors occurring before stream initiation are not reflected correctly #56

@dannykopping

Description

@dannykopping

When sending a streaming request to Anthropic's /v1/messages API, if an error occurs before the stream starts like

HTTP/2.0 400 Bad Request
Content-Length: 164
...

{"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 205351 tokens > 200000 maximum"},"request_id":"req_011CV5J4YZo4J3KLTDZgDN7S"}

then the error is not reflected back correctly.

Right now we're just returning a 200 OK with a blank body.

I haven't validated this against OpenAI /v1/chat/completions but I suspect it suffers from the same shortcoming.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions