kubernetes/kops · error

error creating Network

Error message

error creating Network: %v

What it means

Wrapped error from Network.RenderGCE when the synchronous Networks.Insert call fails for a new network (a == nil). GCE rejected the create — common causes are an invalid CIDR for legacy mode, name collision, permissions, or networks quota.

Solutions

  1. Inspect the wrapped API error for the rejection reason
  2. Verify the network name is unused and the CIDR/mode combination is valid
  3. Clear quota/permission problems and re-run the apply
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

		case "auto":
			network.AutoCreateSubnetworks = true

		case "custom":
			network.AutoCreateSubnetworks = false
			// The boolean default value of "false" is omitted when the struct
			// is serialized, which results in the network being created with
			// the auto-create subnetworks default of "true". Explicitly send
			// the default value.
			network.ForceSendFields = []string{"AutoCreateSubnetworks"}

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

		op, err := t.Cloud.Compute().Networks().Insert(t.Cloud.Project(), network)
		if err != nil {
			return fmt.Errorf("error creating Network: %v", err)
		}
		if err := t.Cloud.WaitForOp(op); err != nil {
			return fmt.Errorf("error waiting for Network creation to complete: %w", err)
		}
	} else {
		if a.Mode == "legacy" {
			return fmt.Errorf("GCE networks in legacy mode are not supported.  Please convert to auto mode or specify a different network.")
		}
		empty := &Network{}
		if !reflect.DeepEqual(empty, changes) {
			return fmt.Errorf("cannot apply changes to Network: %v", changes)
		}
	}

	return nil
}

type terraformNetwork struct {

View on GitHub (pinned to 4c8573c808)