zeroclaw-labs/zeroclaw · error · anyhow::Error
{editor} exited with non-zero status
Error message
{editor} exited with non-zero status What it means
The chosen editor was launched successfully but its process returned a non-zero exit status, so the CLI treats the edit session as failed and refuses to continue. The editor binary name is included in the message.
Source
Thrown at src/skills/mod.rs:1237
let prompt: String = dialoguer::Input::new()
.with_prompt("Skill description (what it does, when to use it)")
.interact_text()?;
if prompt.trim().is_empty() {
anyhow::bail!("description must not be empty");
}
Ok(prompt)
} else {
anyhow::bail!("--description is required when stdin is not a TTY");
}
}
fn open_in_editor(path: &std::path::Path) -> Result<()> {
let Some(editor) = editor_from_env_or_path() else {
anyhow::bail!("no editor found; set VISUAL or EDITOR");
};
let status = std::process::Command::new(&editor).arg(path).status()?;
if !status.success() {
anyhow::bail!("{editor} exited with non-zero status");
}
Ok(())
}
fn editor_from_env_or_path() -> Option<String> {
std::env::var("VISUAL")
.ok()
.filter(|value| !value.trim().is_empty())
.or_else(|| {
std::env::var("EDITOR")
.ok()
.filter(|value| !value.trim().is_empty())
})
.or_else(|| {
fallback_editors()
.iter()
.copied()
.find(|candidate| executable_on_path(candidate))View on GitHub (pinned to 88bb9c8533)
Solutions
- Re-run the command and exit the editor normally (save then quit, e.g. :wq in vim)
- Verify the editor works standalone on the file: $VISUAL /path/to/file
- Use a terminal-based blocking editor (nano, vim) for VISUAL/EDITOR instead of forking GUI editors
- If the editor cannot work in this context, edit the generated file manually at the path the command printed
Example fix
# before export EDITOR='code --wait' # returns before save in some setups # after export EDITOR=vim # blocking terminal editor, exit :wq to continue
Defensive patterns
Strategy: try-catch
Validate before calling
if [ -n "${VISUAL:-${EDITOR:-}}" ]; then
# smoke-test the editor exits 0 on a scratch file before the real run
f=$(mktemp); "${VISUAL:-$EDITOR}" "$f" </dev/null >/dev/null 2>&1 || { echo 'editor unusable' >&2; exit 1; }; rm -f "$f"
fi Try / catch
match err.chain().to_string() containing "exited with non-zero status" -> report which editor failed, print the file path so the user can edit it manually, and exit non-zero without retry
Prevention
- Exit editors with a normal save+quit (:wq, Ctrl+O/Ctrl+X), never :cq
- Point VISUAL/EDITOR at a blocking terminal editor
- Verify wrapper scripts used as EDITOR propagate the child editor's exit status
When it happens
Trigger: Quitting vim with :cq (deliberate non-zero exit); editor crashing on launch; the editor unable to open the path (permissions, bad path); GUI editors that fork and return immediately with a status; a mistyped VISUAL/EDITOR value that resolves to a failing command.
Common situations: Users aborting the editor with an error exit; wrapper scripts set as EDITOR that exit non-zero; editors needing a TTY run without one; VS Code/GUI editors used as EDITOR in non-blocking mode.
Related errors
- no editor found; set VISUAL or EDITOR
- --description is required when stdin is not a TTY
- Unknown integration: {name}. Check README for supported inte
- OpenClaw workspace not found at {}. Pass --source <path> if
- cli-skills-agent-not-configured
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/fb0111b39d7ab817.
Report an issue: GitHub.