Developer finds Claude Code usage-limit hook fires before transcript is fully written
A developer building a Telegram notification tool for Claude Code discovered a subtle timing bug that caused usage-limit alerts to silently fail. When Claude Code hits an account usage limit, it triggers a StopFailure hook, but the session transcript is written asynchronously, meaning the hook can fire before the rate-limit data is flushed to disk. In one logged incident, the developer's code read the transcript just 19.7 milliseconds before Claude Code finished writing it, causing the limit-detection logic to find nothing and fall back to a generic error ping. Because a fallback notification still arrived each time, the failure was invisible until the developer noticed the expected limit-specific message was absent. The finding highlights that the hook payload's transcript path only guarantees the file exists, not that the current turn's data has been fully written to it.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in