[BUG] SDKRateLimitEvent is referenced in SDKMessage union but never defined or implemented (v0.2.45)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Hey! The v2.1.45 changelog mentions:
"Added SDKRateLimitInfo and SDKRateLimitEvent types to the SDK, enabling consumers to receive rate limit status updates including utilization, reset times, and overage information"
I got excited about this — being able to monitor subscription usage limits programmatically would be really useful. So I updated to 0.2.45 and tried to use it, but something seems off.
What I found:
SDKRateLimitEvent appears in the SDKMessage union type in sdk.d.ts:
export declare type SDKMessage = ... | SDKToolUseSummaryMessage | SDKRateLimitEvent;
What Should Happen?
But:
There's no type SDKRateLimitEvent = { ... } definition anywhere in the package
SDKRateLimitInfo doesn't exist at all (not in sdk.d.ts, not in sdk-tools.d.ts)
Neither type appears in the re-exports namespace
No runtime implementation found in sdk.mjs
Running a query and logging every event confirms nothing rate-limit-related is emitted.
Looks like the types got referenced in the union but the actual definitions and runtime implementation didn't make it into the published package. Was this shipped early by accident, or is it coming in a follow-up release?
Error Messages/Logs
Steps to Reproduce
Update to @anthropic-ai/claude-agent-sdk@0.2.45
Run this script to inspect all events emitted by the SDK:
import { query } from '@anthropic-ai/claude-agent-sdk'
async function test() {
for await (const event of query({
prompt: 'Reply with just: "ok"',
options: { model: 'sonnet', maxTurns: 1, permissionMode: 'bypassPermissions' },
})) {
// Log all system events
if (event.type === 'system') {
console.log('[SYSTEM EVENT]', JSON.stringify(event, null, 2))
}
// Search for anything rate-limit related
if (JSON.stringify(event).toLowerCase().includes('rate_limit')) {
console.log('[RATE LIMIT FOUND]', event)
}
}
}
test()
Notice that no rate limit events are emitted
Inspect the installed package directly:
grep -n "SDKRateLimitEvent\|SDKRateLimitInfo" node_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts
Only output: line 1494 (SDKMessage union) — no definition found
grep "SDKRateLimitEvent\|rate_limit_info" node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
No output — no runtime implementation
Confirm: SDKRateLimitEvent appears in the SDKMessage union but has no type definition and no runtime counterpart
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
0.2.45
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗