{"record":{"id":"413a2c56967fe439","repo":"kubernetes/kops","slug":"unhandled-mode-q","errorCode":null,"errorMessage":"unhandled mode %q","messagePattern":"unhandled mode %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/network.go","lineNumber":172,"sourceCode":"\t\t}\n\n\t\tswitch e.Mode {\n\t\tcase \"legacy\":\n\t\t\tnetwork.IPv4Range = fi.ValueOf(e.CIDR)\n\n\t\tcase \"auto\":\n\t\t\tnetwork.AutoCreateSubnetworks = true\n\n\t\tcase \"custom\":\n\t\t\tnetwork.AutoCreateSubnetworks = false\n\t\t\t// The boolean default value of \"false\" is omitted when the struct\n\t\t\t// is serialized, which results in the network being created with\n\t\t\t// the auto-create subnetworks default of \"true\". Explicitly send\n\t\t\t// the default value.\n\t\t\tnetwork.ForceSendFields = []string{\"AutoCreateSubnetworks\"}\n\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unhandled mode %q\", e.Mode)\n\t\t}\n\n\t\top, err := t.Cloud.Compute().Networks().Insert(t.Cloud.Project(), network)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating Network: %v\", err)\n\t\t}\n\t\tif err := t.Cloud.WaitForOp(op); err != nil {\n\t\t\treturn fmt.Errorf(\"error waiting for Network creation to complete: %w\", err)\n\t\t}\n\t} else {\n\t\tif a.Mode == \"legacy\" {\n\t\t\treturn fmt.Errorf(\"GCE networks in legacy mode are not supported.  Please convert to auto mode or specify a different network.\")\n\t\t}\n\t\tempty := &Network{}\n\t\tif !reflect.DeepEqual(empty, changes) {\n\t\t\treturn fmt.Errorf(\"cannot apply changes to Network: %v\", changes)\n\t\t}\n\t}","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/network.go#L154-L190","documentation":"Defensive default-case error from Network.RenderGCE during creation. CheckChanges should have filtered invalid modes already, so reaching this branch means the mode switch was extended inconsistently (or mode validation was bypassed) — the printed mode has no creation handling.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/gcetasks/network.go:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported modes (auto, custom, legacy) in the network spec","Report as a kOps bug if the mode passed validation but has no create path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}