[BUG] Incorrect Working Directory in Resume Command Suggestion

Resolved 💬 3 comments Opened Dec 12, 2025 by ptilsen Closed Dec 16, 2025

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?

I had Claude prepare the report below. The only other context I can add is that Claude may have CDed into the subdirectory at some point well before I closed the session. I had also deleted the subdirectory in question. I was also experiencing the symptom described in this bug, which is why I had closed Claude (I was attempting to change the SHELL variable and see if it fixed the issue). That issue no longer happens now that I've resumed the session successfully; I suspect root cause for that bug in my case is the same as root cause for this bug; Claude was operating from a nonexistent working directory, which caused shell commands to always fail.

Bug Report: Incorrect Working Directory in Resume Command Suggestion

Summary

When attempting to resume a Claude Code session from the session menu, the suggested resume command provides an incorrect working directory, causing the resume to fail with "No conversation found with session ID".

Expected Behavior

The resume command should suggest:

cd /path/to/project && claude --resume <session-id>

Actual Behavior

The resume command incorrectly suggests:

cd /path/to/project/logs && claude --resume <session-id>

Running this command results in:

No conversation found with session ID: <session-id>

Root Cause Analysis

Investigation of the session files reveals:

  1. Session file location shows the correct project directory:
~/.claude/projects/-path-to-project/<session-id>.jsonl
  1. Session conversation history confirms all messages have the correct cwd field:
{"cwd":"/path/to/project","sessionId":"<session-id>",...}
  1. The confusion: The subdirectory (logs) was frequently referenced in Bash tool calls during the session for log file analysis, but was never the actual working directory.

Bug Analysis

The resume suggestion system appears to incorrectly infer the working directory by looking at directories mentioned in tool calls rather than the actual cwd field from the session data.

Example tool calls that may have confused the system:

  • ls -la logs/
  • grep "pattern" "logs/some-file.txt"
  • Multiple file reads from the logs/ subdirectory

The system seems to have incorrectly concluded that logs was the working directory when it was only a frequently-referenced subdirectory within the actual project.

Workaround

The session can be successfully resumed by using the correct working directory found in the session file:

cd /path/to/project && claude --resume <session-id>

Additional Context

  • Claude Code version: 2.0.56 (based on session data)
  • The session files exist and are intact at ~/.claude/projects/-path-to-project/<session-id>.jsonl
  • The cwd field is consistently correct throughout all messages in the session file
  • The subdirectory (logs) exists and is empty (only contains . and ..)

Suggested Fix

The resume command suggestion should use the cwd field from the session data rather than attempting to infer the directory from command arguments or frequently-mentioned paths in tool calls.

What Should Happen?

The resume command should suggest:

cd /path/to/project && claude --resume <session-id>

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce

  1. Have an active Claude Code session in a project directory (e.g., /path/to/project)
  2. During the session, frequently reference a subdirectory in commands (e.g., analyzing log files in logs/ subdirectory using Bash commands like ls -la logs/, grep on files within that directory, etc.)
  3. End the session
  4. Attempt to resume the session by selecting it from the session menu or by browsing projects and selecting one for Claude to provide the command to resume
  5. Observe the wrong CD path in the suggested resume command
  6. Try the command and observe that it does not work

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.67

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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