Claude introduced JS syntax error in Python template, spent 2 sessions misdiagnosing
What happened
While helping with a Flask/PyInstaller app, Claude wrote JavaScript inside a Python triple-quoted HTML template string using \n escape sequences:
NEWS_ANALYTICS_HTML = """
...
<script>
const labels = ['Q1\nMost Bearish','Q2','Q3\nNeutral','Q4','Q5\nMost Bullish'];
...
</script>
"""
In Python, \n inside """...""" is a real newline character. When the Flask route rendered this template, the browser received a literal newline inside a JavaScript string literal — a JS SyntaxError. This silently killed all JavaScript on the page, making every button unresponsive.
What Claude did instead of finding this
- Blamed CDN Plotly script blocking (also a real issue, but not the root cause of button failure)
- Spent one full session adding a
/static/plotly.min.jslocal route fix - Recompiled the exe
- User tested, buttons still broken
- Second session: more remote API probing before finally running
node --checkon the rendered JS, which immediately showed the SyntaxError
Root cause of the wasted sessions
Claude did not verify its own JS output before declaring the fix done. Running node --check on the rendered <script> block would have caught this immediately after writing the code.
What should have happened
After writing any JavaScript inside a Python string template, Claude should validate the rendered JS output for syntax errors before compiling or declaring the task complete.
User impact
Two full sessions of wasted tokens and time. The user asked for a refund.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗