{"record":{"id":"f2e31cd0a0fd4b6e","repo":"tinyhumansai/openhuman","slug":"working-directory-is-not-a-directory-set-a-v","errorCode":null,"errorMessage":"Working directory '{}' is not a directory. Set a valid path in Settings → Agent access → Working directory.","messagePattern":"Working directory '(.+?)' is not a directory\\. Set a valid path in Settings → Agent access → Working directory\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/config/ops/agent.rs","lineNumber":372,"sourceCode":"\n/// Ensure `dir` is usable as a process working directory: it must exist (we\n/// attempt to create it if missing — covers a dir deleted after launch) and\n/// resolve to a directory. Returns a descriptive error naming the path and the\n/// Settings location to fix it, instead of letting the OS surface an opaque\n/// `ERROR_DIRECTORY` (os error 267) from `CreateProcessW`. See issue #3353\n/// (Fix 2). Cheap stat-only calls on the happy path.\npub fn ensure_usable_cwd(dir: &Path) -> anyhow::Result<()> {\n    if !dir.exists() {\n        std::fs::create_dir_all(dir).map_err(|e| {\n            anyhow::anyhow!(\n                \"Working directory '{}' does not exist and could not be created: {e}. \\\n                 Set a valid path in Settings → Agent access → Working directory.\",\n                dir.display()\n            )\n        })?;\n    }\n    if !dir.is_dir() {\n        anyhow::bail!(\n            \"Working directory '{}' is not a directory. \\\n             Set a valid path in Settings → Agent access → Working directory.\",\n            dir.display()\n        );\n    }\n    Ok(())\n}\n\nfn action_dir_source(config: &Config) -> &'static str {\n    if crate::openhuman::config::action_dir_env_override().is_some() {\n        \"env\"\n    } else if config.action_dir_override.is_some() {\n        \"override\"\n    } else {\n        \"default\"\n    }\n}\n","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/config/ops/agent.rs#L354-L390","documentation":"`ensure_usable_cwd` validates the agent working/action directory: it creates the dir when missing (`create_dir_all`), then requires the path to actually be a directory. This bail fires when the path exists but is not a directory — a regular file or file-symlink occupies the location. The message directs the user to Settings → Agent access → Working directory, matching where the path is configured.","triggerScenarios":"`action_dir` (default `~/OpenHuman/projects`, or the override / OPENHUMAN_ACTION_DIR env var) resolves to an existing non-directory: someone created the path as a file, a symlink points at a file, or the override value is a file path.","commonSituations":"Bootstrap scripts or notes tools that `touch`-created the path; a file path pasted into Settings → Agent access → Working directory; OPENHUMAN_ACTION_DIR pointed at a file; leftover artifacts named like the projects dir.","solutions":["Identify and remove/rename the file occupying the path (`ls -l <path>`) so the directory can be created on next start.","Set the Working directory to a valid directory path in Settings → Agent access → Working directory.","Fix OPENHUMAN_ACTION_DIR / action_dir_override to point at a directory; check symlinks resolve to directories."],"exampleFix":"# before — a file occupies the directory path\n$ ls -l ~/OpenHuman/projects\n-rw-r--r-- 1 user users 0 Apr 1 00:00 projects\n\n# after\n$ rm ~/OpenHuman/projects && mkdir -p ~/OpenHuman/projects","handlingStrategy":"validation","validationCode":"if dir.exists() && !dir.is_dir() {\n    anyhow::bail!(\n        \"path occupied by a non-directory: {} — remove it or change the working directory\",\n        dir.display()\n    );\n}\nensure_usable_cwd(dir)?;","typeGuard":"fn is_usable_cwd(dir: &std::path::Path) -> bool {\n    !dir.exists() || dir.is_dir()\n}","tryCatchPattern":null,"preventionTips":["Validate the working-directory value in the Settings UI before saving it","Never point OPENHUMAN_ACTION_DIR / action_dir_override at a file","Check that symlinks in the path resolve to directories","Have bootstrap scripts use mkdir -p, never touch, for the projects dir"],"tags":["config","working-directory","action-dir","filesystem","agent-access"],"backgroundTag":"invalid-working-directory","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}