gitui-org/gitui · error · anyhow::Error

"{command}": {e}

Error message

"{command}": {e}

What it means

Launching the external editor failed at Command::status(): the program string parsed out of the EDITOR variable could not be executed. Almost always ErrorKind::NotFound - the named editor is not installed or not on the PATH gitui inherited - sometimes PermissionDenied (file not executable) or a quoting artifact, because gitui's parsing only understands a leading double-quoted program name or a space-split first token.

Source

Thrown at src/popups/externaleditor.rs:116

				.take_while(|c| *c != '\"')
				.collect()
		} else {
			echars.by_ref().take_while(|c| *c != ' ').collect()
		};

		let remainder_str = echars.collect::<String>();
		let remainder = remainder_str.split_whitespace();

		let mut args: Vec<&OsStr> =
			remainder.map(OsStr::new).collect();

		args.push(path.as_os_str());

		Command::new(command.clone())
			.current_dir(work_dir)
			.args(args)
			.status()
			.map_err(|e| anyhow!("\"{command}\": {e}"))?;

		Ok(())
	}
}

impl DrawableComponent for ExternalEditorPopup {
	fn draw(&self, f: &mut Frame, _rect: Rect) -> Result<()> {
		if self.visible {
			let txt = Line::from(
				strings::msg_opening_editor(&self.key_config)
					.split('\n')
					.map(|string| {
						Span::raw::<String>(string.to_string())
					})
					.collect::<Vec<Span>>(),
			);

			let area = ui::centered_rect_absolute(25, 3, f.area());

View on GitHub (pinned to 2fa693cb6e)

Solutions

  1. Verify from the same environment: command -v "$EDITOR" must resolve to an executable binary.
  2. Keep EDITOR a single unquoted token (EDITOR=vim) or ensure quoting matches gitui's expectations; avoid exotic embedded quotes.
  3. Prepend the editor's directory to PATH in the launcher, or set EDITOR to the absolute path of the binary.
  4. Make sure the target is executable: chmod +x ~/.local/bin/myeditor.

Example fix

# before
export EDITOR=nvim   # nvim not installed -> "nvim": No such file or directory (os error 2)
# after
command -v nvim || sudo apt install neovim
# or point at an absolute path
export EDITOR=/usr/bin/vim
Defensive patterns

Strategy: validation

Validate before calling

# before relying on gitui's edit action
command -v "${EDITOR:-vi}" >/dev/null || echo "editor missing or not on PATH: $EDITOR"

// Rust: which-style probe honoring gitui's quoting
fn editor_on_path(editor: &str) -> bool {
    let bin = editor.strip_prefix('"').and_then(|r| r.split('"').next())
        .or_else(|| editor.split_whitespace().next())
        .unwrap_or("");
    which::which(bin).is_ok()
}

Try / catch

match edit_in_external_editor() {
    Err(e) if e.to_string().contains("No such file") => warn("$EDITOR is not installed"),
    r => r?,
}

Prevention

When it happens

Trigger: EDITOR=nvim with neovim absent; EDITOR pointing at a script without the executable bit; an editor installed under ~/.local/bin that is not on PATH in the launcher's environment (systemd, IDE-embedded terminals); values with unusual quoting that defeat the naive split.

Common situations: Fresh machines before editor packages are installed; PATH differences between interactive login shells and launchers; editors renamed after a distribution upgrade.

Related errors


AI-assisted analysis of gitui-org/gitui@2fa693cb6e (2026-08-16). Data as JSON: /api/errors/d050f0b73eaacf73. Report an issue: GitHub.