{"record":{"id":"adbd75bc78fc3925","repo":"kubernetes/kops","slug":"edit-cancelled-no-valid-changes-were-saved","errorCode":null,"errorMessage":"Edit cancelled: no valid changes were saved.","messagePattern":"Edit cancelled: no valid changes were saved\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/edit_cluster.go","lineNumber":178,"sourceCode":"\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\n\t\tlines, err := hasLines(bytes.NewBuffer(edited))\n\t\tif err != nil {\n\t\t\treturn preservedFile(err, file, out)\n\t\t}\n\t\tif !lines {","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/edit_cluster.go#L160-L196","documentation":"In the edit loop after a previous validation error, the user re-saved the buffer with no effective change (comments-stripped content identical to the prior attempt). kops treats this as a cancel rather than retrying the same failing edit, and reports the preserved temp file.","triggerScenarios":"Thrown at cmd/kops/edit_cluster.go:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the validation errors reported in the buffer header and save again","Or exit the editor without saving to abandon the edit","Check the preserved temp file noted in the message to resume editing"],"exampleFix":null,"handlingStrategy":"validation","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-12T07:17:12.445Z"}