{"version":"2.1.281","anchor":"shell-refuses-to-fall-back-to-another-directory-when-a-pinne","canonical_anchor":"shell-refuses-to-fall-back-to-another-directory-when-a-pinne","heading":"Claude Code stays on a deleted working directory instead of switching elsewhere","tier":null,"area":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281\/e\/shell-refuses-to-fall-back-to-another-directory-when-a-pinne","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.281","markdown":"### Claude Code stays on a deleted working directory instead of switching elsewhere\n\nWhen a session's working directory disappears, Bash refuses to run elsewhere and headless turns keep going with a warning instead of failing\n\n**Unclear.** The finding does not say how a session becomes pinned to a directory.\n\n**What**\n\nThe working directory is the folder a session runs its commands in. This release changes what happens when that folder is deleted while a session is using it.\n\n- Bash commands: if the shell's working directory has been deleted and the session is pinned to it, the Bash tool (which runs shell commands for Claude) no longer quietly moves to a fallback directory. It returns an error instead: \"Working directory ... no longer exists, so shell commands cannot run until it is restored.\" Before, it logged \"Shell CWD \u2026 no longer exists, recovering to\" and switched directories.\n\n- Headless turns: in headless mode (the SDK or print mode, where Claude Code runs without the interactive screen), a turn that starts after the directory has disappeared no longer fails. The turn stays pinned to the missing path and logs \"working directory \u2026 no longer exists; the turn starts pinned to it\". Once per session, it tells you: \"The session's working directory ... no longer exists; shell commands cannot start there and relative file paths that use it will fail until it is restored.\" The message names the path except in some cases.\n\n**Why**\n\nCommands no longer quietly run in a different folder than the one you expected, which could have changed or created files in the wrong place. For SDK and print-mode runs, deleting the folder no longer ends the turn. Instead you get a clear warning, and shell commands and relative paths won't work until the folder is restored."}