[BUG]

Resolved 💬 3 comments Opened Apr 23, 2026 by ethan-beakmask Closed Apr 23, 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?

Claude Code's project path encoding (~/.claude/projects/<encoded-cwd>/) replaces every non-ASCII character with a single -. For any project path containing CJK (Chinese/Japanese/Korean), Cyrillic, Arabic, Thai, or other non-ASCII characters, this produces guaranteed collisions between paths that share the same ASCII skeleton and the same number of non-ASCII characters — regardless of language or semantic content.

The downstream effect is not cosmetic: sessions from unrelated projects are merged into the same project directory. /resume, the session picker, Session Memory recall, and any tool enumerating a project's history will surface and load transcripts from completely different projects. This degrades Claude Code's context quality and is a likely source of "hallucinations" that non-English-speaking users commonly report but cannot explain.

Relation to previous issue: #19972 was previously filed about this same encoding scheme but was closed as not planned and marked stale. That issue framed the problem as readability and third-party tool integration, and self-described collision as "theoretical, low probability." I am filing this as a separate issue because:
(a) collision is guaranteed, not theoretical, for monolingual non-ASCII users — it is a routine daily occurrence;
(b) the actual impact is session isolation failure — a correctness bug, not a UX preference.

Collision example (actual encoded directory names):

| Original path | Encoded directory |
|---|---|
| /opt/Ethan_Lab/星雲資料核心 (Traditional Chinese: "Nebula Data Core") | -opt-Ethan-Lab------- |
| /opt/Ethan_Lab/星雲情報中枢 (Traditional Chinese: "Nebula Intelligence Hub") | -opt-Ethan-Lab------- |
| /opt/Ethan_Lab/성운정보핵심 (Korean: "Nebula Information Core") | -opt-Ethan-Lab------- |

Three semantically distinct projects in two different languages collapse to the same directory. Claude Code cannot tell them apart.

What Should Happen?

Each distinct absolute project path should map to a distinct directory under ~/.claude/projects/. Sessions, Session Memory, /resume history, and sessions-index.json for one project must never be visible or loaded when Claude Code runs in a different project.

Any of these encoding schemes would solve this:

  1. Percent-encoding (URL-encoding) of non-ASCII characters — reversible, standard, filesystem-safe. Example: /opt/Ethan_Lab/星雲資料核心-opt-Ethan-Lab-%E6%98%9F%E9%9B%B2%E8%B3%87%E6%96%99%E6%A0%B8%E5%BF%83
  1. Preserve non-ASCII characters and only escape filesystem-reserved characters (/, \, null, etc.) — most readable; modern filesystems (ext4, APFS, NTFS) all handle UTF-8 filenames natively. Example: -opt-Ethan-Lab-星雲資料核心
  1. Hash-based encoding with a sidecar metadata file storing the real path — guaranteed uniqueness, fixed length, cross-platform.

Minimum viable interim fix (if a full encoding change is deferred): On session start, compute the encoded path and check whether the corresponding directory already contains JSONL files whose first-line cwd field differs from the current cwd. If so, emit a prominent warning that session history will be cross-polluted, and refuse to proceed or require confirmation. This is a few lines of code and immediately unblocks users who would otherwise silently accumulate contamination.

Error Messages/Logs

No error messages. The bug manifests as **silent data contamination** — Claude Code proceeds normally, but session data from unrelated projects is loaded into the current project's context. This silent nature is a major reason the bug has persisted for two years: users do not see errors, they experience subtle model confusion and attribute it to generic "hallucination."

Steps to Reproduce

Tested on Claude Code v2.1.108, Ubuntu, ext4 filesystem, locale zh_TW.UTF-8.

Step 1. Create three directories whose names differ only in non-ASCII characters but share an identical ASCII skeleton and character count:

cd /opt/Ethan_Lab
mkdir 星雲資料核心     # Traditional Chinese: "Nebula Data Core"
mkdir 星雲情報中枢     # Traditional Chinese: "Nebula Intelligence Hub"
mkdir 성운정보핵심     # Korean: "Nebula Information Core"

Step 2. Start a Claude Code session in each directory in turn and ask a trivial question:

cd /opt/Ethan_Lab/성운정보핵심 && claude
# Ask anything, then /q

cd /opt/Ethan_Lab/星雲情報中枢 && claude
# Ask: "How many past conversations in this directory?"
# Claude reports 2 — but this is the project's FIRST conversation.
# The "2nd" is actually the Korean project's session from the previous step.

cd /opt/Ethan_Lab/星雲資料核心 && claude
# Ask: "How many past conversations?" — reports 3.
# Ask for full paths of the historical conversations.

Step 3. Observe that all three distinct projects store their sessions in the same encoded directory:

/home/ethan/.claude/projects/-opt-Ethan-Lab-------/<uuid>.jsonl

Step 4. Verify with a filesystem scan. Any directory with a run of 3+ consecutive dashes is almost certainly a collision target:

ls ~/.claude/projects/ | grep -E '\-{3,}'

Step 5. Confirm cross-project contamination by inspecting the cwd field recorded in each JSONL's first line:

for f in ~/.claude/projects/-opt-Ethan-Lab-------/*.jsonl; do
    head -1 "$f" | python3 -c "import sys, json; print(json.loads(sys.stdin.read()).get('cwd'))"
done

The output shows multiple distinct cwd values in the same directory, proving sessions from different projects are co-mingled.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.108

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

Why This Is a Correctness Bug, Not Cosmetic

Session collision has direct consequences on Claude Code's behavior:

  1. /resume shows foreign sessions. The user is offered conversations from unrelated projects as resumable sessions for the current project.
  1. Session Memory pollutes across projects. If Session Memory is enabled, summaries written in Project A are recalled when the user starts a session in Project B with a colliding encoding, so Claude "remembers" decisions, file paths, and commitments made in a completely different context.
  1. sessions-index.json cross-writes. Multiple concurrent sessions in the colliding directory can interleave JSONL entries (see #26964). This collision bug creates that concurrency condition across conceptually separate projects.
  1. --continue picks the wrong "last" session. It resolves to the most recently modified JSONL in the colliding directory, which may belong to a foreign project.
  1. Hallucination source. When the model is asked about prior work, or Session Memory injects recalled summaries, the content it sees is from a different project. Users experience this as Claude confidently referring to code, decisions, or files it never actually saw. Non-English-speaking users report this symptom but rarely identify the root cause.

Scope of Affected Users

Every Claude Code user whose project paths contain non-ASCII characters:

  • CJK markets (Taiwan, Hong Kong, mainland China, Japan, Korea)
  • Southeast Asia (Thai, Vietnamese)
  • Middle East (Arabic, Hebrew)
  • Eastern Europe (Cyrillic, Greek)
  • Any user with accented Latin characters in their path (French, German, Spanish, Portuguese, Turkish, etc.)
  • Every user with a non-ASCII username on Windows/macOS — that username appears in every project's absolute path

Collision likelihood is not "low probability". For a monolingual user working in their native-language directory names, collision is routine and often occurs within the same parent folder.

Environment

  • Claude Code version: 2.1.108
  • OS: Ubuntu (Linux)
  • Shell: bash
  • Filesystem: ext4 (full UTF-8 support)
  • Locale: zh_TW.UTF-8
  • Node.js: (run node --version to fill in)

Related Issues

  • #19972 — previously raised about this encoding scheme (closed as not planned, marked stale); same root cause but framed as a readability/third-party-integration concern. Filing separately because the correctness impact (session isolation failure) was not established there.
  • #26964 — JSONL cross-session contamination within a project directory. This collision bug creates that condition across unrelated projects.
  • #6246 — UTF-8 corruption in hook system.
  • #36464 — UTF-8 surrogate encoding error on Windows with Korean directory paths.
  • #40396 — CJK characters corrupted to U+FFFD in Claude Code responses.
  • #14310 — Panic on UTF-8 character boundary (CJK).
  • #38765 — Edit tool corrupts non-ASCII Unicode characters.
  • #31295 — Bash tool corrupts UTF-8 non-ASCII in inline arguments on Windows.
  • #51584 — File pane fails on Cyrillic characters.

The pattern across these issues strongly suggests Claude Code has a systemic ASCII-centric assumption in path and string handling that warrants a coordinated audit.

Request

Reclassify as a correctness bug (area:core, priority:high) rather than an enhancement. This silently breaks the product's session-isolation guarantee for a significant international user population.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗