Skip to content

Error 503 causing rate limit header parse failure #57

Description

@willavos

I encountered a 'failed to parse' rate limit header log today in production, running go-anthropic v2.11.0
Our tracing picked up that we hit an error 503. Which suggests we hit an error at their load balancing / routing stage (?)

image

Hitting a 503 caused rate limit headers to fail to parse, as there was no text for any of the headers.

error(s) parsing rate limit headers: failed to parse anthropic-ratelimit-requests-limit: strconv.Atoi: parsing "": invalid syntax failed to parse anthropic-ratelimit-requests-remaining: strconv.Atoi: parsing "": invalid syntax failed to parse anthropic-ratelimit-requests-reset: parsing time "" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "2006" failed to parse anthropic-ratelimit-tokens-limit: strconv.Atoi: parsing "": invalid syntax failed to parse anthropic-ratelimit-tokens-remaining: strconv.Atoi: parsing "": invalid syntax failed to parse anthropic-ratelimit-tokens-reset: parsing time "" as "2006-01-02T15:04:05Z07:00": cannot parse "" as "2006"

We may need have a way to handle these sorts of errors - which are from before their API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions