Hmbown/CodeWhale · error
is not a directory: . Resume/fork from an existing…
Error message
{source} is not a directory: {}. Resume/fork from an existing workspace or pass an explicit `working_dir`/`cwd` What it means
`validate_shell_working_dir` checks that the workspace the shell tool will run in exists and is a directory. When a saved session workspace or an explicitly requested `working_dir`/`cwd` resolves to something missing or non-directory (file, symlink to nothing, deleted path), execution is refused with guidance to resume/fork from a valid workspace or pass an explicit directory.
Solutions
- Pass an explicit `working_dir`/`cwd` pointing to an existing directory
- Resume/fork from a workspace that still exists on disk (recreate the path if it was deleted)
- Check the saved session workspace path exists (`ls <path>`) before resuming
- Fix typos or convert relative paths to absolute existing directories
Example fix
// before
shell({"command": "cargo test"}) // saved workspace was deleted
// after
shell({"command": "cargo test", "working_dir": "/home/me/project"}) Defensive patterns
Strategy: validation
Validate before calling
let wd = opts.working_dir.as_ref().or(saved_workspace.as_ref()); if let Some(p) = wd { if !p.is_dir() { return Err(anyhow!("working dir missing or not a directory: {}", p.display())); } } Type guard
fn is_valid_working_dir(p: &Path) -> bool { p.is_dir() } Try / catch
match shell_execute(opts) { Err(e) if e.to_string().contains("is not a directory") => { let wd = prompt_for_existing_dir(); shell_execute(opts.with_working_dir(wd)) }, Err(e) => Err(e), Ok(v) => Ok(v) } Prevention
- Verify the saved session workspace still exists before resuming/forking
- Always pass an absolute, existing directory for working_dir/cwd
- Recreate or re-point workspaces after container restarts or /tmp cleanups
- Check that the path wasn't replaced by a file (e.g. by tooling) before running shell commands
When it happens
Trigger: Executing the shell tool after resuming/forking a session whose saved workspace path no longer exists or now points to a file; passing an explicit `working_dir`/`cwd` that is not a directory.
Common situations: Resuming a session from a machine/container where /tmp was cleaned or the project moved; a workspace directory deleted while the session was open; typos or relative paths in `working_dir`; a path that was a directory replaced by a file.
Related errors
- AutomationEditorInvalidWorkspace
- Cargo metadata contains duplicate workspace package names
- Cargo metadata omits workspace package ids
- classifier-approved read command was empty
- fleet task ' ' is write-capable but declares no…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/c6e61576aca900a2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/shell.rs:143
fn validate_shell_working_dir(path: &Path, inherited_session_workspace: bool) -> Result<()> {
let metadata = std::fs::metadata(path).with_context(|| {
let source = if inherited_session_workspace {
"saved session workspace"
} else {
"requested working directory"
};
format!(
"{source} is unavailable: {}. Restore or remap that directory, resume/fork the session from an existing workspace, or pass an explicit `working_dir`/`cwd` to exec_shell",
path.display()
)
})?;
if !metadata.is_dir() {
let source = if inherited_session_workspace {
"saved session workspace"
} else {
"requested working directory"
};
return Err(anyhow!(
"{source} is not a directory: {}. Resume/fork from an existing workspace or pass an explicit `working_dir`/`cwd`",
path.display()
));
}
Ok(())
}
/// Status of a shell process.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum ShellStatus {
Running,
Completed,
Failed,
Killed,
TimedOut,
}
/// Result from a shell command execution.View on GitHub (pinned to 73e0f67d83)