abiosoft/colima · error

no editor found in $PATH, kindly set $EDITOR environment var

Error message

no editor found in $PATH, kindly set $EDITOR environment variable and try again

What it means

Thrown by launchEditor in cmd/util.go when no text editor can be resolved. The resolution order is: an editor passed explicitly by the calling command, then VSCode detection via TERM_PROGRAM=vscode, then the $EDITOR environment variable, then a hardcoded preference list (vim, 'code --wait --new-window', nano) probed with exec.LookPath. If every step fails, the interactive edit flow aborts with this error.

Source

Thrown at cmd/util.go:92

			editor = e
		}
	}

	// if not found, check the preferred editors
	if editor == "" {
		for _, e := range editors {
			s := strings.Fields(e)
			if _, err := exec.LookPath(s[0]); err == nil {
				editor = e
				log.Println("editing in", e)
				break
			}
		}
	}

	// if still not found, abort
	if editor == "" {
		return fmt.Errorf("no editor found in $PATH, kindly set $EDITOR environment variable and try again")
	}

	// some editors need the wait flag, let us add it if the user has not.
	switch editor {
	case "code", "code-insiders", "code-oss", "codium", "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code":
		editor = strconv.Quote(editor) + " --wait --new-window"
	case "mate", "/Applications/TextMate 2.app/Contents/MacOS/mate", "/Applications/TextMate 2.app/Contents/MacOS/TextMate":
		editor = strconv.Quote(editor) + " --wait"
	}

	return cli.CommandInteractive("sh", "-c", editor+" "+file).Run()
}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Export EDITOR to a terminal editor that exists, e.g. export EDITOR=nano, and retry the command
  2. Install one of the probed editors: apt-get install -y vim (or nano), or brew install nano
  3. For VSCode run 'Shell Command: Install code command in PATH' from the command palette so exec.LookPath finds 'code'
  4. In CI or scripts, ensure the EDITOR variable is passed through instead of stripped from the environment

Example fix

# before
unset EDITOR
colima start --edit   # error: no editor found in $PATH

# after
export EDITOR=vim
colima start --edit
Defensive patterns

Strategy: validation

Validate before calling

// resolveEditor reports whether launchEditor will find an editor.
func resolveEditor() bool {
    if os.Getenv("TERM_PROGRAM") == "vscode" {
        return true
    }
    if e := os.Getenv("EDITOR"); e != "" {
        return true
    }
    for _, e := range []string{"vim", "code", "nano"} {
        if _, err := exec.LookPath(e); err == nil {
            return true
        }
    }
    return false
}

Try / catch

err := launchEditor(editor, file)
if err != nil {
    if strings.Contains(err.Error(), "no editor found in $PATH") {
        // hint the user rather than failing silently
        log.Println("set $EDITOR (e.g. export EDITOR=nano) and retry")
    }
    return err
}

Prevention

When it happens

Trigger: Running a command that opens config for editing (e.g. 'colima start --edit') on a host where $EDITOR is unset/empty and exec.LookPath fails for every entry of the editors slice (vim, code, nano). On a VSCode terminal the TERM_PROGRAM check sets 'code --wait' without verifying it is in PATH, so the fallback list is still skipped only when the variable is set.

Common situations: Minimal Docker containers or CI runners with no editors installed; VSCode installed as a GUI app but the 'code' shell command never installed; SSH sessions where $EDITOR was never exported; wrapper scripts that scrub the environment before invoking colima.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/bf2aff650bd3b1f2. Report an issue: GitHub.