You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MessageParseError on rate_limit_event message type terminates async generator #601
The CLI emits a rate_limit_event message at session start on every run. The SDK's parse_message function does not handle this message type, hitting the catch-all case in its match statement and raising MessageParseError. Since this exception occurs inside the async generator, it terminates the stream and the consumer never receives the ResultMessage with output, cost data, or session ID.
This is not triggered by actually hitting a rate limit. It's an informational status message emitted on 100% of sessions.
from claude_agent_sdk import query, ClaudeAgentOptions
async for message in query(
prompt="What is 2 + 2?",
options=ClaudeAgentOptions(allowed_tools=["Bash"]),
):
print(message)
Raises MessageParseError before ResultMessage is received.
Environment
claude-agent-sdk==0.1.39
Python 3.14.3
macOS (Darwin)
Claude Code CLI in PATH, authenticated via OAuth token
Suggested fix
Handle rate_limit_event in parse_message by either returning a SystemMessage with the payload or silently skipping it. The data is informational and should not terminate the stream.
Confirmed. This seems to have started happening in the past few hours. Initially I thought it was multiple calls hitting the API (originating from Task calls spawning subagents) but this doesn't seem to be the case, as robcalvillo describes. I still haven't been able to find a workaround.
I thought it was the past few hours but there are Issues raised on the Claude Code repo describing this that are at least a couple of days old. Oddly enough I was able to use it fine earlier today, but then it abruptly stopped.
This was fixed in commit 2d5c3cb (PR #648 — "feat: add typed RateLimitEvent message"), which shipped in v0.1.49. The parser now handles rate_limit_event messages and returns a typed RateLimitEvent instead of raising MessageParseError. Closing this issue.
Activity
NickFall commentedon Feb 21, 2026
Confirmed.
This seems to have started happening in the past few hours.Initially I thought it was multiple calls hitting the API (originating from Task calls spawning subagents) but this doesn't seem to be the case, as robcalvillo describes. I still haven't been able to find a workaround.I thought it was the past few hours but there are Issues raised on the Claude Code repo describing this that are at least a couple of days old. Oddly enough I was able to use it fine earlier today, but then it abruptly stopped.
anthropics/claude-code#26498
anthropics/claude-code#26669
igor-gorohovsky-sembly commentedon Feb 22, 2026
I encountered the same problem. I can't run my agent, it always fails with
MessageParseError.feat: add RateLimitEvent and fix allowed_tools=[] truthiness bug
feat: add typed RateLimitEvent message
feat: add typed RateLimitEvent message (#648)
qing-ant commentedon Mar 24, 2026
This was fixed in commit
2d5c3cb(PR #648 — "feat: add typed RateLimitEvent message"), which shipped in v0.1.49. The parser now handlesrate_limit_eventmessages and returns a typedRateLimitEventinstead of raisingMessageParseError. Closing this issue.