PulseAugur
EN
LIVE 14:58:59

Popular Claude Code repo overcounts tokens due to documented bug

A developer has identified a significant bug in the popular `claude-code-templates` repository, which has led to an overcounting of token usage by 2.35 times. The issue stems from how the code sums message usage, counting tokens multiple times for each content block within a single assistant message. This problem was documented by Anthropic in their Agent SDK documentation, which even provided a reference implementation for a fix, yet the bug persisted in the widely-used template repository. The developer noted that a simple assertion checking distinct message IDs against record counts would have flagged the issue immediately. AI

IMPACT Highlights potential for significant cost overruns in AI agent development due to unaddressed token counting bugs.

RANK_REASON Developer identifies and documents a bug in a popular open-source code repository related to LLM token counting.

Read on dev.to — LLM tag →

AI-generated summary · Google Gemini · from 1 sources. How we write summaries →

Popular Claude Code repo overcounts tokens due to documented bug

COVERAGE [1]

  1. dev.to — LLM tag TIER_1 English(EN) · Li Zhuojun ·

    The vendor documents this bug. A 30k-star repo shipped it anyway.

    <p>This is part three of a series about pointing an append-only audit log at things that count tokens. <a href="https://dev.to/lizhuojunx86/a-missing-model-line-was-half-my-ai-agent-overspend-auditing-34-days-of-multi-model-claude-code-mc7">Part one</a> found that a single missin…