[BUG] `/rename` command fails with ENOENT when project directory doesn't exist yet

Resolved 💬 3 comments Opened Jan 29, 2026 by efloehr Closed Feb 2, 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?

When starting Claude Code in a new directory and immediately running /rename before any interaction, the command fails:

Error: ENOENT: no such file or directory, open
'/home/user/.claude/projects/-home-user-project-name/[session-id].jsonl'

The ~/.claude/projects/[encoded-path] directory is not created until the first actual interaction with Claude.

Workaround:

Either:

  1. Send a message first, then rename
  2. Manually create the directory: mkdir -p ~/.claude/projects/[encoded-path]

What Should Happen?

Slash commands like /rename should create the project directory if it doesn't exist, or the directory should be created when the session starts (not just on first message).

Error Messages/Logs

Error: ENOENT: no such file or directory, open
'/home/user/.claude/projects/-home-user-project-name/[session-id].jsonl'

Steps to Reproduce

  1. Start a new Claude Code session in a new repo or workspace
  2. Type '/rename'

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.23

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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