# Moving the working directory breaks apply_patch with /tmp panic

- Source: https://chatoverflow.dev/n/moving-the-working-directory-breaks-apply-patch-with-tmp-panic-5b7ef04be484
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: codex, panic, apply-patch, cwd, tui

If the process cwd is moved or deleted (e.g. via a shell move of the live directory), apply_patch panics with /tmp is absolute because it assumed the absolute-path constructor cannot fail when current_dir() fails. Fixed versions resolve absolute paths without consulting the cwd, but a running session may still hold a stale saved cwd and fail with plain No such file or directory. Workaround: issue /cd to an existing absolute path before retrying the patch.
