kubernetes/kops · error
error launching editor: %v
Error message
error launching editor: %v
What it means
With --edit (the default), kOps launches an interactive editor (from KUBE_EDITOR/EDITOR env vars) so the user can adjust the new InstanceGroup YAML. This error is returned when the editor process itself cannot be started or exits with a failure, before kOps even attempts to parse the result.
Source
Thrown at cmd/kops/create_instancegroup.go:273
if options.Edit {
edit := editor.NewDefaultEditor(commandutils.EditorEnvs)
raw, err := kopscodecs.ToVersionedYaml(ig)
if err != nil {
return err
}
ext := "yaml"
// launch the editor
edited, file, err := edit.LaunchTempFile(fmt.Sprintf("%s-edit-", filepath.Base(os.Args[0])), ext, bytes.NewReader(raw))
defer func() {
if file != "" {
try.RemoveFile(file)
}
}()
if err != nil {
return fmt.Errorf("error launching editor: %v", err)
}
obj, _, err := kopscodecs.Decode(edited, nil)
if err != nil {
return fmt.Errorf("error parsing yaml: %v", err)
}
group, ok := obj.(*kopsapi.InstanceGroup)
if !ok {
return fmt.Errorf("unexpected object type: %T", obj)
}
err = validation.CrossValidateInstanceGroup(group, cluster, cloud, true).ToAggregate()
if err != nil {
return err
}
ig = group
}View on GitHub (pinned to 4c8573c808)
Solutions
- Set KUBE_EDITOR or EDITOR to an installed editor (e.g. `export EDITOR=vim` or `EDITOR='code --wait'`)
- Use `--edit=false` to skip interactive editing when automating
- Ensure the command runs in an interactive TTY session
- Check the wrapped error (%v) for the exact exec failure (binary not found vs exit status)
Example fix
// before kops create instancegroup ig # EDITOR=/usr/bin/nope // after export EDITOR=vim # or: kops create instancegroup ig --edit=false
Defensive patterns
Strategy: validation
Validate before calling
command -v "${KUBE_EDITOR:-${EDITOR}}" >/dev/null 2>&1 || export EDITOR=vim
tty -s || EDIT-less=true # skip --edit when non-interactive Try / catch
err := RunCreateInstanceGroup(...)
if err != nil && strings.Contains(err.Error(), "error launching editor") {
// retry with options.Edit = false or fix EDITOR and rerun
} Prevention
- Always set EDITOR or KUBE_EDITOR to an installed binary
- Use --edit=false in CI and non-interactive shells
- Verify a TTY exists before interactive commands
- For VS Code use EDITOR='code --wait'
When it happens
Trigger: Running `kops create instancegroup` in an environment where the editor cannot launch: EDITOR/KUBE_EDITOR set to a nonexistent binary, no TTY available (non-interactive CI shell), or the editor exiting non-zero (user aborts in vim with :cq, or the editor crashes).
Common situations: CI/automation invoking the command without a terminal; EDITOR pointing to an uninstalled program; editor saving and exiting nonzero; docker exec or SSH sessions without proper TERM/TTY.
Related errors
- error launching editor: %v
- Edit cancelled: no valid changes were saved.
- Error too many '=' (%d) in %s
- at least one channel URL is required
- building menu for %q: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/06054be1418d86f8.
Report an issue: GitHub.