{"record":{"id":"e029019bd2e2344a","repo":"glzr-io/glazewm","slug":"shell-exec-failed-for-command-program-path-is","errorCode":null,"errorMessage":"Shell exec failed for '{command}': program path is not valid.","messagePattern":"Shell exec failed for '(.+?)': program path is not valid\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/wm/src/commands/general/shell_exec.rs","lineNumber":154,"sourceCode":"      return Ok(((*first_part).to_string(), args));\r\n    }\r\n  }\r\n\r\n  let mut cumulative_path = Vec::new();\r\n\r\n  // Lastly, iterate over the command until a valid file path is found.\r\n  for (part_index, &part) in command_parts.iter().enumerate() {\r\n    cumulative_path.push(part);\r\n\r\n    if Path::new(&cumulative_path.join(\" \")).is_file() {\r\n      return Ok((\r\n        cumulative_path.join(\" \"),\r\n        command_parts[part_index + 1..].join(\" \"),\r\n      ));\r\n    }\r\n  }\r\n\r\n  anyhow::bail!(\r\n    \"Shell exec failed for '{command}': program path is not valid.\"\r\n  )\r\n}\r\n","sourceCodeStart":136,"sourceCodeEnd":158,"githubUrl":"https://github.com/glzr-io/glazewm/blob/5709ad0a3c7c386bbc3e38166a865ffc12937515/packages/wm/src/commands/general/shell_exec.rs#L136-L158","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"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.","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"],"exampleFix":"// before\nshell_exec(\"C:/Program Files/App/app.exe --flag\", ...);\n// after\nshell_exec(\"\\\"C:/Program Files/App/app.exe\\\" --flag\", ...);","handlingStrategy":"validation","validationCode":"if !std::path::Path::new(&program_path).exists() {\n  eprintln!(\"program path does not exist: {program_path}\");\n} else {\n  shell_exec(command_line, vec![], None, false)?;\n}","typeGuard":null,"tryCatchPattern":"match shell_exec(cmd, vec![], None, false) {\n  Err(e) if e.to_string().contains(\"program path is not valid\") => {\n    eprintln!(\"quote paths with spaces and verify the executable exists\");\n  }\n  r => r?,\n}","preventionTips":["Quote paths containing spaces in shell_exec commands","Keep the program path as the first, unambiguous token","Prefer absolute single-token executable paths"],"tags":["shell","parsing","path"],"backgroundTag":"command-not-found","analyzedSha":"5709ad0a3c7c386bbc3e38166a865ffc12937515","analyzedAt":"2026-09-08T03:26:40.288Z","contentChangedAt":"2026-09-08T03:26:40.288Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}