Skip to content

fix: handle unknown message types (e.g. rate_limit_event) gracefully#72

Merged
RichardAtCT merged 1 commit intoRichardAtCT:mainfrom
lyra63237:fix/handle-rate-limit-event
Feb 20, 2026
Merged

fix: handle unknown message types (e.g. rate_limit_event) gracefully#72
RichardAtCT merged 1 commit intoRichardAtCT:mainfrom
lyra63237:fix/handle-rate-limit-event

Conversation

@lyra63237
Copy link
Copy Markdown
Contributor

Problem

The claude-agent-sdk's message parser raises MessageParseError for unrecognised message types like rate_limit_event. Since receive_response() yields parse_message(data) without catching this error, it propagates up and kills the entire request with:

Claude SDK error: Unknown message type: rate_limit_event

This affects users on Claude Max/Pro subscriptions where rate limit events are sent inline during streaming.

Fix

Wrap the response iteration in sdk_integration.py to catch MessageParseError and skip unknown message types rather than failing the entire request. The actual assistant response and result message still come through normally.

Testing

Tested on a production deployment with Claude Max subscription — responses now complete successfully with rate limit events silently skipped.

Fixes #70

The claude-agent-sdk's message parser raises MessageParseError for
unrecognised message types like rate_limit_event. This causes the entire
request to fail with 'Unknown message type: rate_limit_event'.

Instead of letting the error propagate, catch MessageParseError during
response iteration and skip the unknown message, allowing the rest of
the response (including the actual result) to come through.

Fixes RichardAtCT#70
@lyra63237 lyra63237 force-pushed the fix/handle-rate-limit-event branch from ee5263a to 589afd8 Compare February 20, 2026 14:08
@RichardAtCT
Copy link
Copy Markdown
Owner

@claude you happy with this bro?

@claude
Copy link
Copy Markdown

claude bot commented Feb 20, 2026

Claude Code is working…

I'll analyze this and get back to you.

View job run

@RichardAtCT
Copy link
Copy Markdown
Owner

Thanks for the fix!

@RichardAtCT RichardAtCT merged commit 830e1e8 into RichardAtCT:main Feb 20, 2026
2 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.

rate_limit_event

2 participants