Session creation fails for directories with trailing whitespace in path (trust mismatch)

Open 💬 0 comments Opened Jul 4, 2026 by kyui-azusa

Description

If a project directory name ends with a trailing space (e.g. /Users/me/dev/develop — valid on macOS/APFS), Claude Code stores the trust/project entry in ~/.claude.json under the exact path including the trailing space, but session creation appears to resolve/normalize the path without it.

The result is that new sessions cannot be established in that directory, and the failure surfaces as a trust problem (and later as "Working directory no longer exists") rather than pointing at the path mismatch — which makes it very hard to diagnose.

Steps to reproduce

  1. mkdir '/tmp/develop ' (note the trailing space)
  2. Start a Claude Code session in that directory and accept the trust dialog — ~/.claude.json gains a projects key of "/tmp/develop " (with trailing space)
  3. Try to create a new session in the same directory — it fails with trust-related errors, or "Working directory no longer exists: /tmp/develop" (note the error message shows the path without the trailing space)

Expected behavior

Either handle trailing-whitespace paths consistently everywhere (store and resolve with the same key), or normalize them consistently at both write and read time. In either case the error message should not silently strip the trailing space, since that sends the user debugging a directory that "exists" when listed.

Environment

  • macOS (Darwin 24.5.0), directory on a local APFS volume
  • Observed with the trust entry stored in ~/.claude.json under projects

View original on GitHub ↗