{"record":{"id":"51fd15b6a25e7f8e","repo":"Hmbown/CodeWhale","slug":"no-executable-search-path-is-configured","errorCode":null,"errorMessage":"no executable search path is configured","messagePattern":"no executable search path is configured","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/shell.rs","lineNumber":4380,"sourceCode":"    let workspace = workspace.canonicalize().ok()?;\n    let safe = std::env::split_paths(path).filter_map(|entry| {\n        if !entry.is_absolute() {\n            return None;\n        }\n        let resolved = entry.canonicalize().ok()?;\n        (!resolved.starts_with(&workspace)).then_some(resolved)\n    });\n    std::env::join_paths(safe).ok()\n}\n\nfn readonly_sanitized_path(workspace: &std::path::Path) -> Option<String> {\n    let path = std::env::var_os(\"PATH\")?;\n    readonly_sanitized_path_from(workspace, &path).map(|value| value.to_string_lossy().into_owned())\n}\n\nfn resolve_readonly_program(program: &str, workspace: &std::path::Path) -> Result<PathBuf> {\n    let path = std::env::var_os(\"PATH\")\n        .ok_or_else(|| anyhow!(\"no executable search path is configured\"))?;\n    resolve_readonly_program_from_path(program, workspace, &path)\n}\n\nfn resolve_readonly_program_from_path(\n    program: &str,\n    workspace: &std::path::Path,\n    path: &std::ffi::OsStr,\n) -> Result<PathBuf> {\n    let workspace = workspace.canonicalize()?;\n    if std::path::Path::new(program).components().count() != 1 {\n        return Err(anyhow!(\n            \"read-only command must name a bare allowlisted executable\"\n        ));\n    }\n    let safe_path = readonly_sanitized_path_from(&workspace, path).ok_or_else(|| {\n        anyhow!(\"no trusted executable search path remains outside the workspace\")\n    })?;\n    let names = if cfg!(windows) {","sourceCodeStart":4362,"sourceCodeEnd":4398,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/shell.rs#L4362-L4398","documentation":"`resolve_readonly_program` reads the `PATH` environment variable to search for an allowlisted read-only executable. If `PATH` is absent from the process environment, `std::env::var_os(\"PATH\")` returns None and this error is thrown, because the resolver cannot enumerate candidate directories for the program.","triggerScenarios":"Executing a read-only shell command (e.g. `git status`, `rg pattern`) in a process whose environment has no `PATH` variable at all — distinct from an empty PATH, which simply yields no candidates.","commonSituations":"Spawning the app with a scrubbed/empty environment (`env -i`, `Command::env_clear()` in a parent); container or CI images that never set PATH for the service user; systemd units or cron jobs with minimal `Environment=` blocks.","solutions":["Ensure `PATH` is set in the environment launching the process, e.g. `env PATH=/usr/bin:/bin <app>`","In Rust parents, use `Command::env(\"PATH\", ...)` rather than `env_clear()` without re-adding PATH","In systemd/cron, add `Environment=\"PATH=/usr/local/bin:/usr/bin:/bin\"` to the unit or job"],"exampleFix":"// before (parent Rust process)\nCommand::new(app).env_clear().status()\n// after\nCommand::new(app).env_clear().env(\"PATH\", \"/usr/local/bin:/usr/bin:/bin\").status()","handlingStrategy":"validation","validationCode":"fn path_configured() -> bool {\n    std::env::var_os(\"PATH\").is_some_and(|p| !p.is_empty())\n}\nassert!(path_configured(), \"PATH must be set before running read-only commands\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never launch the tool with env_clear() without restoring PATH","Set PATH explicitly in containers, systemd units, and cron jobs","Check `echo $PATH` in the exact environment (IDE, service, CI) that runs the app"],"tags":["environment","path","shell","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}