[BUG] Wasted paid session quota by ignoring explicit constraints and looping on broken scripts

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 25, 2026

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?

  1. Claude Code must strictly respect explicit user constraints (e.g., "Do not use DeepL").
  2. Claude Code should have a "circuit breaker" mechanism. If a script execution fails multiple times in a row on the same underlying logic, it should pause, stop executing code, and hand control back to the user instead of burning tokens in an automated loop.

What Should Happen?

  1. Claude Code must strictly respect explicit user constraints (e.g., "Do not use DeepL").
  2. Claude Code should have a "circuit breaker" mechanism. If a script execution fails multiple times in a row on the same underlying logic, it should pause, stop executing code, and hand control back to the user instead of burning tokens in an automated loop.

Error Messages/Logs

The CLI looped through multiple variations of a Node.js script failing with errors like:
- `SyntaxError: Unexpected end of input`
- `ERREUR : Cannot read properties of undefined (reading 'replace')`
- `Erreur API: 456 - {"message":"Quota exceeded"}`

This loop persisted for over an hour, consuming context and tokens.

Steps to Reproduce

  1. Provide Claude Code with a large JS file (~2565 lines) containing key-value pairs for translation.
  2. Explicitly instruct the AI: "My DeepL account is closed. Do not generate scripts using the DeepL API."
  3. Observe that Claude Code ignores the constraint and writes a Node.js script using the DeepL API anyway.
  4. The script fails due to bad string parsing.
  5. Claude Code attempts to fix the bug, re-runs the script, it fails again on a different bug, and it loops this exact behavior (generate -> fail -> fix -> fail) indefinitely.

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Claude Code for VS Code v2.1.220

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

This behavior cost me half of my paid Claude session quota. Ignoring explicit security/cost constraints (like "do not use this closed API") combined with an infinite execution loop is a critical flaw that makes the tool financially dangerous to use for debugging or scripting tasks.
Update: Agent introduced a critical UI bug and admitted to fabricating verification

What happened: during the automated translation of the file by the agent, every value in LABELS_PLAIN was replaced with an I18N.t('data.label.xxx', 'French text') call. However, these calls were made directly inside the const object definition—meaning they were executed only once when the script loaded in the browser.
javascript

// BEFORE (correct but not translated):
const LABELS_PLAIN = { checkbox: '☑️ Cases', ... };

// WHAT WAS INTRODUCED (bug):
const LABELS_PLAIN = { checkbox: I18N.t('data.label.checkbox', '☑️ Cases'), ... };

The impact: The application features a language selector that hot-swaps languages without reloading the page (I18N.setLang() updates the DOM instantly). But because LABELS_PLAIN is a frozen object evaluated only once at load time, a teacher switching languages mid-session would continue to see the question-type badges in the previous language until a full page reload—an inconsistent display compared to the rest of the UI, which updates correctly.

Why it wasn't detected before delivery: The two automated checks performed afterwards could not see this problem:

node --check: only verifies that the JavaScript is syntactically valid, not its runtime behavior.
Key comparison between lang/fr.js, lang/en.js, lang/de.js, lang/es.js, lang/nl.js: only verifies that the 5 translation files are coherent with each other, not that the consuming code behaves correctly.
Neither checks when a value is evaluated. The bug was only found by reading the file's git diff manually, afterwards — which should have been done before declaring the work finished.

(Note: This completely contradicts the agent's previous claim that it was "Verified correct by hand (diff read)").

Fix applied by agent: LABELS_PLAIN was reverted to a static French object (fallback), and a dataLabel(type) function was added, which calls I18N.t() on every call (i.e., on every badge render) rather than just once at load time. The 3 usage points (js/editor.js lines 188 and 201, js/config-panel.js line 16) were updated to call dataLabel(type) instead of reading directly from the frozen object.

View original on GitHub ↗