zeroclaw-labs/zeroclaw · error · anyhow::Error

no editor found; set VISUAL or EDITOR

Error message

no editor found; set VISUAL or EDITOR

What it means

open_in_editor needs an editor to open the generated skill file. editor_from_env_or_path checks VISUAL, then EDITOR (both must be non-empty), then a fallback list (notepad.exe/nano/vim and similar) located on PATH. This error means every source came up empty, so the file cannot be opened for editing.

Source

Thrown at src/skills/mod.rs:1233

    {
        return Ok(d);
    }
    if std::io::IsTerminal::is_terminal(&std::io::stdin()) {
        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(|| {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Export VISUAL or EDITOR to a working editor, e.g. export VISUAL=vim
  2. Install a fallback editor such as nano or vim and make sure it is on PATH
  3. Skip the editor step by supplying all content via non-interactive flags and editing the file manually afterwards at the printed path

Example fix

# before
zeroclaw skills create my-skill   # no editor found
# after
export VISUAL=nano
zeroclaw skills create my-skill
Defensive patterns

Strategy: fallback

Validate before calling

# check an editor will be found before running the command
if [ -z "${VISUAL:-${EDITOR:-}}" ] && ! command -v nano vim vi >/dev/null 2>&1; then
  echo "no editor available; set VISUAL or EDITOR" >&2; exit 1
fi

Prevention

When it happens

Trigger: VISUAL and EDITOR unset (or set to empty/whitespace strings, which are filtered out) and no fallback editor binary found on PATH; minimal container or CI images that ship no editor; PATH not including the directory containing nano/vim.

Common situations: Docker/CI images without editors installed; fresh minimal shells where VISUAL/EDITOR were never configured; headless servers; the env var set but empty (export EDITOR="").

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/91d7d919e2633355. Report an issue: GitHub.