[BUG] Non-ASCII project path encoding causes guaranteed directory collisions and breaks --resume

Resolved 💬 8 comments Opened Mar 30, 2026 by psh4607 Closed Jun 3, 2026

Summary

Claude Code's project path encoding replaces each non-ASCII character with -, creating a lossy, non-reversible mapping that causes guaranteed directory collisions between different project paths. This also breaks --resume for any external tooling that computes project directory paths.

The Problem

1. Guaranteed Directory Collisions

Claude Code encodes project paths by replacing non-ASCII characters character-by-character with -. Any two directory names with the same number of non-ASCII characters collide:

| Actual Path | Encoded Directory |
|---|---|
| ~/projects/외주/app | ...projects----app |
| ~/projects/개인/app | ...projects----app |
| ~/projects/회사/app | ...projects----app |

All three map to the exact same directory. This is not a theoretical edge case — it's a guaranteed collision for any CJK, Arabic, Cyrillic, or accented character paths of equal length.

2. Undocumented Encoding Breaks External Tooling

The encoding algorithm is not documented. Tools that need to compute the project directory path (e.g., session management scripts, WayLog, custom CLI wrappers) cannot reliably determine where Claude stores sessions.

A concrete failure case:

# External script computes path with shell: preserves Unicode
_D=~/.claude/projects/$(pwd | sed 's|/|-|g')
# Result: ...projects-외주-app  ← WHERE THE SCRIPT COPIES TO

# Claude Code internally encodes: non-ASCII replaced with -
# Result: ...projects----app    ← WHERE CLAUDE ACTUALLY LOOKS

Running claude --resume <id> fails with "No conversation found" because the session file was copied to the wrong directory.

3. Silent Session Mixing

When collisions occur, sessions from entirely different projects are stored in the same directory. While session IDs prevent data corruption, project-scoped session listings would show sessions from unrelated projects with no way to distinguish their origin.

Steps to Reproduce

Collision Demo

# Create two projects with different CJK names (same char count)
mkdir -p ~/test/외주/app ~/test/개인/app

# Start Claude in each
cd ~/test/외주/app && claude  # creates session
cd ~/test/개인/app && claude  # creates session in SAME directory

# Verify collision
ls ~/.claude/projects/ | grep test
# Only ONE directory for both projects

--resume Failure

cd ~/test/외주/app

# Compute path the way external tools would (preserving Unicode)
echo $(pwd | sed 's|/|-|g')
# ...test-외주-app  ← doesn't match Claude's internal encoding

# Copy session file to this path → claude --resume <id> fails

Why This Is Serious

| Impact | Severity | Description |
|--------|----------|-------------|
| Silent failure | Critical | No error at write time; failure only surfaces on --resume, making debugging extremely difficult |
| Tooling breakage | High | Any tool computing project paths externally will silently target the wrong directory |
| Internationalization | High | Affects ALL users with non-ASCII paths — Korean, Chinese, Japanese, Arabic, Cyrillic, accented Latin, etc. |
| Data mixing | Medium | Sessions from different projects share a directory, confusing project-scoped listings |

Suggested Fix

Option A: URL-encode non-ASCII characters (recommended)

~/projects/외주/app → ...-projects-%EC%99%B8%EC%A3%BC-app
  • Reversible, collision-free, filesystem-safe, standard (RFC 3986)

Option B: Preserve non-ASCII characters as-is

~/projects/외주/app → ...-projects-외주-app
  • Modern filesystems (APFS, ext4, NTFS) fully support Unicode directory names

Benefits of Fixing

  • Zero collisions: Every unique path maps to a unique directory
  • Predictable encoding: External tools can reliably compute project paths
  • i18n correctness: International users get the same reliability as ASCII-only users
  • Ecosystem enablement: Third-party integrations can work without reverse-engineering the encoding

Environment

  • Claude Code Version: Latest
  • Platform: macOS (APFS)
  • Path characters tested: Korean (Hangul)

Related Issues

  • #19972 — Same root cause, closed as stale. This issue provides concrete collision proof and --resume breakage evidence.
  • #36464 — UTF-8 surrogate encoding error on Windows with Korean paths
  • #18285 — Korean folder name encoding issues in Cowork

View original on GitHub ↗

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