{"record":{"id":"3993a93b23e77ac7","repo":"kubernetes/kops","slug":"error-launching-editor-v-3993a9","errorCode":null,"errorMessage":"error launching editor: %v","messagePattern":"error launching editor: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/edit_cluster.go","lineNumber":173,"sourceCode":"\n\tcontainsError := false\n\n\tfor {\n\t\tbuf := &bytes.Buffer{}\n\t\tresults.header.writeTo(buf)\n\t\tresults.header.flush()\n\n\t\tif !containsError {\n\t\t\tbuf.Write(raw)\n\t\t} else {\n\t\t\tbuf.Write(stripComments(edited))\n\t\t}\n\n\t\t// launch the editor\n\t\teditedDiff := edited\n\t\tedited, file, err = editor.LaunchTempFile(fmt.Sprintf(\"%s-edit-\", filepath.Base(os.Args[0])), ext, buf)\n\t\tif err != nil {\n\t\t\treturn preservedFile(fmt.Errorf(\"error launching editor: %v\", err), results.file, out)\n\t\t}\n\n\t\tif containsError {\n\t\t\tif bytes.Equal(stripComments(editedDiff), stripComments(edited)) {\n\t\t\t\treturn preservedFile(fmt.Errorf(\"%s\", \"Edit cancelled: no valid changes were saved.\"), file, out)\n\t\t\t}\n\t\t}\n\n\t\tif len(results.file) > 0 {\n\t\t\ttry.RemoveFile(results.file)\n\t\t}\n\n\t\tif bytes.Equal(stripComments(raw), stripComments(edited)) {\n\t\t\ttry.RemoveFile(file)\n\t\t\tfmt.Fprintln(out, \"Edit cancelled: no changes made.\")\n\t\t\treturn nil\n\t\t}\n","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/edit_cluster.go#L155-L191","documentation":"RunEditCluster launches $EDITOR (or $KOPS_EDITOR/$GIT_EDITOR) on a temp file holding the cluster YAML; this wraps LaunchTempFile failing - no editor configured/found, or the temp directory is not writable. The original edit buffer is preserved via preservedFile.","triggerScenarios":"Thrown at cmd/kops/edit_cluster.go:173 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set EDITOR (or KOPS_EDITOR) to a working editor command","Check that the temp directory is writable","Use --set/--unset flags instead of interactive editing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}