[BUG] Khmer script (km) generation loops on "org" token — systematic failure in Claude Code
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?
Environment:
- Claude Code CLI on Windows 10 Pro (10.0.19045)
- Model: Claude Opus 4.6 (1M context)
- Claude Code version: 2.1.86
- Shell: bash
- Date observed: 2026-03-30
Description:
When generating Khmer script (Unicode range U+1780–U+17FF) in Claude Code, the model consistently degenerates into an
infinite repetition of the token "org" after approximately 10–15 Khmer characters. This happens regardless of the
output method used.
Reproduction — all of these methods fail identically:
- Direct Write tool — writing a .md file with Khmer content
- Edit tool — replacing English text with Khmer translations
- Bash heredoc — cat > file.md << 'EOF' with Khmer content
- Python with Unicode escapes — python -c "s = '\u1781\u17D2\u1798...' " — the escape sequences themselves get
corrupted mid-generation, producing \u1794org org org org...
- Subagent delegation — delegating to a Sonnet subagent produces the same result
Example of corrupted output:
អ្នកដោះសorg org org org org org org org org org org org org org org org org org org org org org org org org org org
org org ...
The output always starts with valid Khmer text (5–15 characters), then abruptly switches to repeating "org" for the
remainder of the output buffer.
Key observations:
- Very short Khmer strings work fine (e.g., app name "ឌីតុកឌីជីថល" — 5 syllables). The bug only triggers when
generating longer text.
- Other complex scripts are unaffected. Thai (th), Bengali (bn), Georgian (ka), Armenian (hy), and all other scripts
among 76 tested languages generated correctly in the same session, same model, same workflow.
- This is not a one-time glitch. Over 20+ attempts across two days (2026-03-30 and 2026-03-31) with various
strategies, the result was identical every time.
- The corruption token is always "org" — never random garbage, always the same 3-letter token.
- Previously worked. The user reports that Khmer generation worked correctly in earlier Claude Code sessions (exact
version unknown). The app_localizations.dart file in the same project contains valid Khmer strings that were generated
by Claude in a prior session — though those are short (1–3 word) values stored as Unicode escapes.
Workaround attempted:
Building the file incrementally via Python, concatenating fragments of ~8 Unicode escapes each, partially worked — but
the model still produced "org" loops in the escape sequences themselves when the total Khmer content in a single
generation exceeded ~15 characters.
Suspected cause:
Khmer script likely has very fine-grained tokenization (each character or sub-character component = 1 token), causing
the model to lose coherence on long sequences of these low-frequency tokens. The consistent "org" token suggests a
specific failure mode in the sampling/decoding layer rather than random degeneration.
Impact:
Complete inability to produce Google Play Store listings, documentation, or any substantial text in Khmer via Claude
Code. This blocks localization workflows for Khmer-speaking users (~16 million speakers).
What Should Happen?
Claude Code should generate Khmer script text of any length without degeneration, the same way it successfully generates Thai, Bengali, Georgian, Armenian, and 72 other scripts in the same project and session. A full Google Play
Store listing (~1500–2000 characters of Khmer text) should be produced cleanly in a single Write or Edit tool call, with no token repetition loops.
Error Messages/Logs
No explicit error messages are produced — the model does not crash or throw exceptions. The failure is silent: valid Khmer output simply degenerates into repeated "org" tokens mid-generation. The tools report success (e.g., "File
created successfully"), but the written content is corrupted.
The only actual error occurred when corrupted Unicode escapes broke Python syntax:
File "<string>", line 2
line = '\n\u1780\u17bb\u17c6... \u1793\u17b6\u1791\u17b8\u1780\u17d2\u179a\u17c4\u1799\u1794org org org org
org...'
^
SyntaxError: unterminated string literal (detected at line 2)
This happened because the "org" repetition loop injected raw ASCII into the middle of a Python Unicode escape string,
breaking the \u escape sequence syntax.
Steps to Reproduce
- Open Claude Code CLI on any platform
- Create or open a project with a text file (e.g., a Markdown file)
- Ask Claude to write content in Khmer language. Minimal example:
Prompt: "Translate the following text to Khmer and save it to km.md:
Put your phone down for 10 minutes. Sounds easy? Prove it. Earn unique rewards.
You just picked up your phone again, didn't you? No judgment. We all do it. The average person checks their phone 96
times a day — that's once every 10 minutes. You unlock it, scroll for just a second, and suddenly 45 minutes have
vanished into a TikTok rabbit hole about cats learning to skateboard.
This is the simplest digital detox app ever made. Here's how it works: Tap Start, put your phone down, don't touch it
for 10 minutes. That's it.
Your phone knows when you pick it up. The built-in accelerometer detects even the slightest movement. Think you can
cheat? You can't."
- Observe the output — the first 10–15 Khmer characters will be valid, then the rest will be org org org org org
org... repeated until the output buffer is exhausted.
- Try alternative methods — Edit tool, Bash heredoc, Python with \u Unicode escapes — the result is identical.
- For comparison, ask Claude to translate the same text to Thai, Bengali, or any other non-Latin script — it will
generate correctly without any loops.
Minimal reproduction (single command):
Ask Claude Code:
Write a file test_km.md with this content in Khmer: "Put your phone down for 10 minutes. You just picked up your phone
again. No judgment. We all do it. The average person checks their phone 96 times a day."
Expected: ~100 characters of valid Khmer script.
Actual: ~10–15 valid Khmer characters followed by hundreds of repeated "org" tokens.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.86
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
<img width="811" height="908" alt="Image" src="https://github.com/user-attachments/assets/42e2c0fd-6baa-4bf4-8496-172fa3720842" />
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗