glzr-io/glazewm · error
Shell exec failed for
Error message
Shell exec failed for '{command}': program path is not valid. What it means
`parse_command` (called from `shell_exec`) splits the command into parts and tries to resolve which leading tokens form the program path. If no split yields a valid existing program path, it bails with this message.
Solutions
- Quote or escape paths with spaces correctly in the command string
- Ensure the executable actually exists at the given path
- Simplify the command so the program path is the first unambiguous token, or use a single-token absolute path
Example fix
// before
shell_exec("C:/Program Files/App/app.exe --flag", ...);
// after
shell_exec("\"C:/Program Files/App/app.exe\" --flag", ...); Defensive patterns
Strategy: validation
Validate before calling
if !std::path::Path::new(&program_path).exists() {
eprintln!("program path does not exist: {program_path}");
} else {
shell_exec(command_line, vec![], None, false)?;
} Try / catch
match shell_exec(cmd, vec![], None, false) {
Err(e) if e.to_string().contains("program path is not valid") => {
eprintln!("quote paths with spaces and verify the executable exists");
}
r => r?,
} Prevention
- Quote paths containing spaces in shell_exec commands
- Keep the program path as the first, unambiguous token
- Prefer absolute single-token executable paths
When it happens
Trigger: `shell_exec` invoked with a command whose program portion cannot be resolved — e.g. quoting is wrong so the path is split mid-way, or the executable does not exist at any candidate cumulative path.
Common situations: Config entries like `shell_exec "C:/Program Files/My App/app.exe"` where the space-splitting heuristic can't reconstruct the path, uninstalled programs, or paths with unescaped spaces.
Related errors
AI-assisted analysis of glzr-io/glazewm@5709ad0a3c (2026-09-08).
Data as JSON: /api/errors/e029019bd2e2344a.
Report an issue: GitHub.
Appendix: source
Thrown at packages/wm/src/commands/general/shell_exec.rs:154
return Ok(((*first_part).to_string(), args));
}
}
let mut cumulative_path = Vec::new();
// Lastly, iterate over the command until a valid file path is found.
for (part_index, &part) in command_parts.iter().enumerate() {
cumulative_path.push(part);
if Path::new(&cumulative_path.join(" ")).is_file() {
return Ok((
cumulative_path.join(" "),
command_parts[part_index + 1..].join(" "),
));
}
}
anyhow::bail!(
"Shell exec failed for '{command}': program path is not valid."
)
}
View on GitHub (pinned to 5709ad0a3c)