kubernetes/kops · error

error launching editor: %v

Error message

error launching editor: %v

What it means

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.

Source

Thrown at cmd/kops/edit_cluster.go:173

	containsError := false

	for {
		buf := &bytes.Buffer{}
		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
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set EDITOR (or KOPS_EDITOR) to a working editor command
  2. Check that the temp directory is writable
  3. Use --set/--unset flags instead of interactive editing
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/kops/edit_cluster.go:173 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/3993a93b23e77ac7. Report an issue: GitHub.