{"record":{"id":"0ddca358d7348cc5","repo":"glzr-io/glazewm","slug":"shell-exec-failed-for-command-command-doesn-t","errorCode":null,"errorMessage":"Shell exec failed for '{command}': command doesn't have an ending `\"`.","messagePattern":"Shell exec failed for '(.+?)': command doesn't have an ending `\"`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/wm/src/commands/general/shell_exec.rs","lineNumber":120,"sourceCode":"      state.dispatcher.expand_env_strings(command)?\r\n    }\r\n    #[cfg(target_os = \"macos\")]\r\n    {\r\n      // TODO: Expand env variables on macOS.\r\n      command.to_string()\r\n    }\r\n  };\r\n\r\n  let command_parts =\r\n    expanded_command.split_whitespace().collect::<Vec<_>>();\r\n\r\n  // If the command starts with double quotes, then the program name/path\r\n  // is wrapped in double quotes (e.g. `\"C:\\path\\to\\app.exe\" --flag`).\r\n  if expanded_command.starts_with('\"') {\r\n    // Find the closing double quote.\r\n    let (closing_index, _) =\r\n      expanded_command.match_indices('\"').nth(2).ok_or_else(|| {\r\n        anyhow::anyhow!(\r\n          \"Shell exec failed for '{command}': command doesn't have an ending `\\\"`.\"\r\n        )\r\n      })?;\r\n\r\n    return Ok((\r\n      expanded_command[1..closing_index].to_string(),\r\n      expanded_command[closing_index + 1..].trim().to_string(),\r\n    ));\r\n  }\r\n\r\n  // The first part is the program name if it doesn't contain a slash or\r\n  // backslash.\r\n  if let Some(first_part) = command_parts.first() {\r\n    if !first_part.contains(&['/', '\\\\'][..]) {\r\n      let args = command_parts[1..].join(\" \");\r\n      return Ok(((*first_part).to_string(), args));\r\n    }\r\n  }\r","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/glzr-io/glazewm/blob/5709ad0a3c7c386bbc3e38166a865ffc12937515/packages/wm/src/commands/general/shell_exec.rs#L102-L138","documentation":"`parse_command` in shell_exec splits a shell command into a program name and arguments. When the command string starts with a double quote, the program path is expected to be wrapped in quotes (e.g. `\"C:\\\\path\\\\to\\\\app.exe\" --flag`); if no second closing quote exists, `match_indices('\"').nth(2)` returns `None` and this error is raised with the original command echoed back.","triggerScenarios":"Calling `shell_exec` with a command like `\"C:\\\\Program Files\\\\app.exe --flag` — starts with `\"` but has no matching closing quote before the arguments.","commonSituations":"Config files where a quoted path lost its closing quote (manual edit, escaping issues in TOML/JSON, line truncation); commands copied from Windows with smart quotes or partial quoting.","solutions":["Add the missing closing quote around the program path: `\"C:\\\\path\\\\to\\\\app.exe\" --flag`.","If the path has no spaces, drop the quotes entirely so the quoted-path branch is skipped.","Inspect the `command` value echoed in the error and fix the quoting in the config source (e.g. `general.yml` startup or keybinding command).","Escape quotes correctly for your config format if the shell command itself contains quotes.","Validate the command string in an editor/shell before putting it into the config."],"exampleFix":"// before (config)\ncommand: '\"C:\\\\Program Files\\\\app.exe --flag'\n// after\ncommand: '\"C:\\\\Program Files\\\\app.exe\" --flag'","handlingStrategy":"validation","validationCode":"fn shell_exec_command_is_quoted(cmd: &str) -> bool {\n  if cmd.starts_with('\"') { cmd[1..].contains('\"') } else { true }\n}","typeGuard":null,"tryCatchPattern":"let (program, args) = parse_command(&cmd).map_err(|e| {\n  eprintln!(\"Fix quoting in shell command: {e}\");\n  e\n})?;","preventionTips":["Always close quotes around program paths containing spaces.","Avoid smart quotes when editing config files.","Test shell commands in a terminal before adding them to config."],"tags":["rust","shell-exec","config","quoting"],"backgroundTag":"invalid-argument-format","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"}