Summary
On a Windows machine, every shell/command execution fails with Failed to execute command: The directory name is invalid. (os error 267) — even trivial commands like echo hello or pwd. The shell tool cannot initialise because the configured working directory is invalid at the OS level.
Problem
What happened: Every shell tool call (shell, node_exec, npm_exec) fails with the same error. Commands like echo hello, pwd, dir, ls all fail identically. The error is os error 267 which maps to Windows ERROR_DIRECTORY — the directory name is invalid.
What was expected: The shell tool should either (a) fall back to a valid directory, (b) surface a clear error about which path is invalid and why, or (c) auto-create the missing directory.
Impact: The agent is completely unable to execute any shell commands, read files, run scripts, or interact with the filesystem. This blocks all code-repo work, file operations, and general tool usage on Windows.
Version / Platform:
- Platform: Windows 11 - 25H2 (OS Build 26200.8457)
- OpenHuman version: v0.57.13
Solution (suspected)
The root cause is likely a mismatch between workspace_dir and action_dir:
workspace_dir defaults to ~/.openhuman/users/<id>/workspace — this path is auto-created at startup and is valid.
action_dir defaults to ~/OpenHuman/projects — this path is the shell tool's CWD. If it doesn't exist (e.g. the user never created it, or the tilde expansion produces a malformed Windows path like C:\Users\Harry/OpenHuman/projects with mixed separators), cmd.current_dir() will fail with ERROR_DIRECTORY.
- The shell tool does NOT check if
action_dir exists before setting it as CWD — it just passes it to cmd.current_dir() and lets the OS error bubble up as a generic "Failed to execute command" message.
- The error message is opaque — it doesn't tell the user WHICH directory is invalid or why.
Related: Issue #2379 (closed) fixed a similar "program not found" problem on Windows by adding Windows env vars to the allowlist. This is a different failure mode (invalid directory path vs missing executable).
Acceptance criteria
Related
Summary
On a Windows machine, every shell/command execution fails with
Failed to execute command: The directory name is invalid. (os error 267)— even trivial commands likeecho helloorpwd. The shell tool cannot initialise because the configured working directory is invalid at the OS level.Problem
What happened: Every shell tool call (shell, node_exec, npm_exec) fails with the same error. Commands like
echo hello,pwd,dir,lsall fail identically. The error isos error 267which maps to WindowsERROR_DIRECTORY— the directory name is invalid.What was expected: The shell tool should either (a) fall back to a valid directory, (b) surface a clear error about which path is invalid and why, or (c) auto-create the missing directory.
Impact: The agent is completely unable to execute any shell commands, read files, run scripts, or interact with the filesystem. This blocks all code-repo work, file operations, and general tool usage on Windows.
Version / Platform:
Solution (suspected)
The root cause is likely a mismatch between
workspace_dirandaction_dir:workspace_dirdefaults to~/.openhuman/users/<id>/workspace— this path is auto-created at startup and is valid.action_dirdefaults to~/OpenHuman/projects— this path is the shell tool's CWD. If it doesn't exist (e.g. the user never created it, or the tilde expansion produces a malformed Windows path likeC:\Users\Harry/OpenHuman/projectswith mixed separators),cmd.current_dir()will fail withERROR_DIRECTORY.action_direxists before setting it as CWD — it just passes it tocmd.current_dir()and lets the OS error bubble up as a generic "Failed to execute command" message.Related: Issue #2379 (closed) fixed a similar "program not found" problem on Windows by adding Windows env vars to the allowlist. This is a different failure mode (invalid directory path vs missing executable).
Acceptance criteria
ERROR_DIRECTORYon Windows whenaction_dirdoesn't existaction_diris invalid, the error message tells the user which path is the problem and suggests a fix (e.g. "The configured action_dir 'X' does not exist. Set a valid path in Settings → Agent → Working Directory or create the directory.")action_dirat startup (likeworkspace_diris), or fall back to a valid temp directory with a warningRelated