{"record":{"id":"47665cec1f0a6234","repo":"glzr-io/glazewm","slug":"shell-exec-failed-for-command-make-sure-the-p","errorCode":null,"errorMessage":"Shell exec failed for '{command}'. Make sure the program exists and is accessible from your shell. Error: {err}","messagePattern":"Shell exec failed for '(.+?)'\\. Make sure the program exists and is accessible from your shell\\. Error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/wm/src/commands/general/shell_exec.rs","lineNumber":58,"sourceCode":"    {\r\n      let home_dir =\r\n        home::home_dir().context(\"Unable to get home directory.\")?;\r\n\r\n      // TODO: Use `Shell::spawn` instead. `ShellExecuteExW` is still used\r\n      // to be able to launch programs from the App Paths registry\r\n      // (`HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths`), like\r\n      // `chrome` without it being in $PATH.\r\n      state.dispatcher.shell_execute_ex(\r\n        &program,\r\n        &args,\r\n        &home_dir,\r\n        hide_window,\r\n      )\r\n    }\r\n  };\r\n\r\n  result.map_err(|err| {\r\n    anyhow::anyhow!(\r\n      \"Shell exec failed for '{command}'. Make sure the program exists and is \\\r\n      accessible from your shell. Error: {err}\",\r\n    )\r\n  })?;\r\n\r\n  Ok(())\r\n}\r\n\r\n/// Parses a command string into a program name/path and arguments. This\r\n/// also expands any environment variables found in the command string if\r\n/// they are wrapped in `%` characters. If the command string is a path,\r\n/// a file extension is required.\r\n///\r\n/// This is similar to the `SHEvaluateSystemCommandTemplate` Win32\r\n/// function. It also parses program name/path and arguments, but can't\r\n/// handle `/` as file path delimiters and it errors for certain programs\r\n/// (e.g. `code`).\r\n///\r","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/glzr-io/glazewm/blob/5709ad0a3c7c386bbc3e38166a865ffc12937515/packages/wm/src/commands/general/shell_exec.rs#L40-L76","documentation":"`shell_exec` spawns a shell command via the platform API and wraps any spawn failure with this message naming the command and the underlying OS error. It means the OS could not run the program — typically the executable was not found or is not executable.","triggerScenarios":"`shell_exec(executable, args, ...)` where the program path does not exist, lacks the execute bit / PATH resolution fails, or the OS denies spawning.","commonSituations":"Keybinding configs invoking apps like `\"code\"` or `\"alacritty\"` that are not on PATH or not installed, wrong absolute paths, or missing file permissions.","solutions":["Verify the program is installed and resolvable from your shell (`which <program>` / `where <program>`)","Use an absolute path to the executable in the config","Inspect the wrapped `err` in the message for the precise OS cause"],"exampleFix":"// before\nshell_exec(\"code\", vec![], None, false)?;\n// after\nshell_exec(\"C:\\\\Program Files\\\\Microsoft VS Code\\\\Code.exe\", vec![], None, false)?;","handlingStrategy":"validation","validationCode":"fn program_exists(program: &str) -> bool {\n  std::process::Command::new(\"where\")\n    .arg(program)\n    .output()\n    .map(|o| o.status.success())\n    .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match shell_exec(command, args, None, false) {\n  Err(e) if e.to_string().contains(\"Shell exec failed\") => {\n    eprintln!(\"check that '{command}' is installed and on PATH\");\n  }\n  r => r?,\n}","preventionTips":["Verify executables exist before binding them in keybinding configs","Prefer absolute paths for non-PATH programs","Keep the target programs installed and accessible from the shell profile"],"tags":["shell","process-spawn","config"],"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"}