Hmbown/CodeWhale · error · anyhow::Error
no executable search path is configured
Error message
no executable search path is configured
What it means
The read-only executor resolves the program binary itself against PATH so workspace entries can be excluded from the search; if `std::env::var_os("PATH")` returns None the resolution cannot even start and this error is returned. The Codewhale process was launched with no PATH at all, so every read-only command will fail the same way until the environment is fixed.
Source
Thrown at crates/tui/src/tools/shell.rs:3883
let workspace = workspace.canonicalize().ok()?;
let safe = std::env::split_paths(path).filter_map(|entry| {
if !entry.is_absolute() {
return None;
}
let resolved = entry.canonicalize().ok()?;
(!resolved.starts_with(&workspace)).then_some(resolved)
});
std::env::join_paths(safe).ok()
}
fn readonly_sanitized_path(workspace: &std::path::Path) -> Option<String> {
let path = std::env::var_os("PATH")?;
readonly_sanitized_path_from(workspace, &path).map(|value| value.to_string_lossy().into_owned())
}
fn resolve_readonly_program(program: &str, workspace: &std::path::Path) -> Result<PathBuf> {
let path = std::env::var_os("PATH")
.ok_or_else(|| anyhow!("no executable search path is configured"))?;
resolve_readonly_program_from_path(program, workspace, &path)
}
fn resolve_readonly_program_from_path(
program: &str,
workspace: &std::path::Path,
path: &std::ffi::OsStr,
) -> Result<PathBuf> {
let workspace = workspace.canonicalize()?;
if std::path::Path::new(program).components().count() != 1 {
return Err(anyhow!(
"read-only command must name a bare allowlisted executable"
));
}
let safe_path = readonly_sanitized_path_from(&workspace, path).ok_or_else(|| {
anyhow!("no trusted executable search path remains outside the workspace")
})?;
let names = if cfg!(windows) {View on GitHub (pinned to 0c42157ee5)
Solutions
- Set PATH to include standard system bin dirs (/usr/bin:/bin:/usr/local/bin) before starting the TUI
- For systemd services, add an explicit `Environment=PATH=...` directive to the unit
- Fail fast at startup with a clear configuration error instead of discovering it at the first read-only command
- For tests, re-inject a minimal PATH before exercising the readonly path
Example fix
# before: launched with a scrubbed environment env -i codewhale tui # after: keep a sane PATH env -i PATH=/usr/bin:/bin codewhale tui
Defensive patterns
Strategy: validation
Validate before calling
let Some(path) = std::env::var_os("PATH") else {
return Err(anyhow!("PATH is unset; set it before starting Codewhale"));
};
if std::env::split_paths(&path).next().is_none() {
return Err(anyhow!("PATH is empty"));
} Type guard
fn path_configured() -> bool {
std::env::var_os("PATH").is_some_and(|p| std::env::split_paths(&p).next().is_some())
} Try / catch
if let Err(err) = run_readonly_command(&command) {
if err.to_string().contains("no executable search path is configured") {
return Err(anyhow!("environment misconfigured: PATH is unset; restart with a sane PATH"));
}
return Err(err);
} Prevention
- Assert PATH is set at process startup, before any tool dispatch
- For systemd units, set `Environment=PATH=/usr/bin:/bin` explicitly
- Avoid `env -i` launches unless you re-inject PATH
- Test environments must re-establish PATH before exercising read-only execution
When it happens
Trigger: Running the TUI/headless exec host under an environment with PATH unset: `env -i`, minimal systemd units without `Environment=PATH=...`, container configs that define PATH only for login shells, or tests that clear the environment before dispatching a read-only command.
Common situations: Launching from wrappers or service managers that sanitize the environment; CI jobs with scrubbed env; debugging sessions started with a stripped env.
Related errors
- no trusted executable search path remains outside the worksp
- git not found on PATH
- git not found
- config path cannot be empty
- config path must include a file name
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/51fd15b6a25e7f8e.
Report an issue: GitHub.