{"record":{"id":"06054be1418d86f8","repo":"kubernetes/kops","slug":"error-launching-editor-v","errorCode":null,"errorMessage":"error launching editor: %v","messagePattern":"error launching editor: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/create_instancegroup.go","lineNumber":273,"sourceCode":"\n\tif options.Edit {\n\t\tedit := editor.NewDefaultEditor(commandutils.EditorEnvs)\n\n\t\traw, err := kopscodecs.ToVersionedYaml(ig)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\text := \"yaml\"\n\n\t\t// launch the editor\n\t\tedited, file, err := edit.LaunchTempFile(fmt.Sprintf(\"%s-edit-\", filepath.Base(os.Args[0])), ext, bytes.NewReader(raw))\n\t\tdefer func() {\n\t\t\tif file != \"\" {\n\t\t\t\ttry.RemoveFile(file)\n\t\t\t}\n\t\t}()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error launching editor: %v\", err)\n\t\t}\n\n\t\tobj, _, err := kopscodecs.Decode(edited, nil)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error parsing yaml: %v\", err)\n\t\t}\n\t\tgroup, ok := obj.(*kopsapi.InstanceGroup)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected object type: %T\", obj)\n\t\t}\n\n\t\terr = validation.CrossValidateInstanceGroup(group, cluster, cloud, true).ToAggregate()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tig = group\n\t}","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create_instancegroup.go#L255-L291","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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)"],"exampleFix":"// before\nkops create instancegroup ig  # EDITOR=/usr/bin/nope\n// after\nexport EDITOR=vim  # or: kops create instancegroup ig --edit=false","handlingStrategy":"validation","validationCode":"command -v \"${KUBE_EDITOR:-${EDITOR}}\" >/dev/null 2>&1 || export EDITOR=vim\ntty -s || EDIT-less=true  # skip --edit when non-interactive","typeGuard":null,"tryCatchPattern":"err := RunCreateInstanceGroup(...)\nif err != nil && strings.Contains(err.Error(), \"error launching editor\") {\n\t// retry with options.Edit = false or fix EDITOR and rerun\n}","preventionTips":["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'"],"tags":["cli","editor","interactive"],"backgroundTag":"editor-launch-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}