kubernetes/kops · error

error writing cluster yaml to stdout: %v

Error message

error writing cluster yaml to stdout: %v

What it means

During dry-run YAML output, serializing the populated InstanceGroup to YAML on stdout failed. The object was built successfully; this is an output-stage failure, typically from the YAML printer (or a broken stdout pipe).

Source

Thrown at cmd/kops/create_instancegroup.go:243

		}
		fmt.Println("detected a GCE cluster; labeling nodes to receive metadata-proxy.")
		ig.Spec.NodeLabels["cloud.google.com/metadata-proxy-ready"] = "true"
	}

	if options.DryRun {

		if options.Output == "" {
			return fmt.Errorf("must set output flag; yaml or json")
		}

		// Cluster name is not populated, and we need it
		ig.ObjectMeta.Labels = make(map[string]string)
		ig.ObjectMeta.Labels[kopsapi.LabelClusterName] = cluster.ObjectMeta.Name

		switch options.Output {
		case OutputYaml:
			if err := fullOutputYAML(out, ig); err != nil {
				return fmt.Errorf("error writing cluster yaml to stdout: %v", err)
			}
			return nil
		case OutputJSON:
			if err := fullOutputJSON(out, true, ig); err != nil {
				return fmt.Errorf("error writing cluster json to stdout: %v", err)
			}
			return nil
		default:
			return fmt.Errorf("unsupported output type %q", options.Output)
		}
	}

	if options.Edit {
		edit := editor.NewDefaultEditor(commandutils.EditorEnvs)

		raw, err := kopscodecs.ToVersionedYaml(ig)
		if err != nil {
			return err

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped serialization error for details
  2. Ensure stdout is not a closed/broken pipe
  3. Report as a kops bug if the IG object itself cannot be serialized
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at cmd/kops/create_instancegroup.go:243 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/02479c5bbd9b54df. Report an issue: GitHub.