kubernetes/kops · error

unknown mode %q for Network

Error message

unknown mode %q for Network

What it means

Validation error from Network.CheckChanges. The Mode string on the network spec matches none of the accepted values (auto, custom, legacy, or empty-for-shared); the offending mode is printed. Guards against typos in the spec reaching the GCE API.

Source

Thrown at upup/pkg/fi/cloudup/gcetasks/network.go:134

		if cidr != "" {
			return fmt.Errorf("CIDR cannot specified for networks where mode=%s", e.Mode)
		}
	}

	switch e.Mode {
	case "auto":
	case "custom":
	case "legacy":
		// Known

	case "":
		// Treated as "keep existing", only allowed for shared mode
		if !fi.ValueOf(e.Shared) {
			return fmt.Errorf("must specify mode for (non-shared) Network")
		}

	default:
		return fmt.Errorf("unknown mode %q for Network", e.Mode)
	}

	return nil
}

func (_ *Network) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Network) error {
	shared := fi.ValueOf(e.Shared)
	if shared {
		// Verify the network was found
		if a == nil {
			return fmt.Errorf("Network with name %q not found", fi.ValueOf(e.Name))
		}
	}

	if a == nil {
		klog.V(2).Infof("Creating Network with CIDR: %q", fi.ValueOf(e.CIDR))

		network := &compute.Network{

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Correct the mode in the network spec to one of: auto, custom, or legacy
  2. Leave mode empty only when adopting a pre-existing shared network
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/gcetasks/network.go:134 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/fed8ddaa95d15306. Report an issue: GitHub.