kubernetes/kops · error

Edit cancelled: no valid changes were saved.

Error message

Edit cancelled: no valid changes were saved.

What it means

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.

Source

Thrown at cmd/kops/edit_cluster.go:178

		results.header.writeTo(buf)
		results.header.flush()

		if !containsError {
			buf.Write(raw)
		} else {
			buf.Write(stripComments(edited))
		}

		// launch the editor
		editedDiff := edited
		edited, file, err = editor.LaunchTempFile(fmt.Sprintf("%s-edit-", filepath.Base(os.Args[0])), ext, buf)
		if err != nil {
			return preservedFile(fmt.Errorf("error launching editor: %v", err), results.file, out)
		}

		if containsError {
			if bytes.Equal(stripComments(editedDiff), stripComments(edited)) {
				return preservedFile(fmt.Errorf("%s", "Edit cancelled: no valid changes were saved."), file, out)
			}
		}

		if len(results.file) > 0 {
			try.RemoveFile(results.file)
		}

		if bytes.Equal(stripComments(raw), stripComments(edited)) {
			try.RemoveFile(file)
			fmt.Fprintln(out, "Edit cancelled: no changes made.")
			return nil
		}

		lines, err := hasLines(bytes.NewBuffer(edited))
		if err != nil {
			return preservedFile(err, file, out)
		}
		if !lines {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Fix the validation errors reported in the buffer header and save again
  2. Or exit the editor without saving to abandon the edit
  3. Check the preserved temp file noted in the message to resume editing
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/edit_cluster.go:178 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/adbd75bc78fc3925. Report an issue: GitHub.