{"record":{"id":"c9400e0a0cd9b7c5","repo":"kubernetes/kops","slug":"error-waiting-for-router-creation-w","errorCode":null,"errorMessage":"error waiting for router creation: %w","messagePattern":"error waiting for router creation: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/router.go","lineNumber":176,"sourceCode":"\t\t\t\t\tName:                          *e.Name,\n\t\t\t\t\tNatIpAllocateOption:           *e.NATIPAllocationOption,\n\t\t\t\t\tSourceSubnetworkIpRangesToNat: *e.SourceSubnetworkIPRangesToNAT,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tfor _, subnet := range e.Subnetworks {\n\t\t\trouter.Nats[0].Subnetworks = append(router.Nats[0].Subnetworks, &compute.RouterNatSubnetworkToNat{\n\t\t\t\tName:                subnet.URL(project, region),\n\t\t\t\tSourceIpRangesToNat: []string{subnetNatAllIPRanges},\n\t\t\t})\n\t\t}\n\t\top, err := t.Cloud.Compute().Routers().Insert(project, region, router)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating Router: %w\", err)\n\t\t}\n\t\tif err := t.Cloud.WaitForOp(op); err != nil {\n\t\t\treturn fmt.Errorf(\"error waiting for router creation: %w\", err)\n\t\t}\n\t} else {\n\t\tif !reflect.DeepEqual(changes, &Router{}) {\n\t\t\treturn fmt.Errorf(\"applying changes to Router is unsupported: %s\", *e.Name)\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype terraformRouterNat struct {\n\tName                          *string                         `cty:\"name\"`\n\tRegion                        *string                         `cty:\"region\"`\n\tRouter                        *terraformWriter.Literal        `cty:\"router\"`\n\tNATIPAllocateOption           *string                         `cty:\"nat_ip_allocate_option\"`\n\tSourceSubnetworkIPRangesToNat *string                         `cty:\"source_subnetwork_ip_ranges_to_nat\"`\n\tSubnetworks                   []*terraformRouterNatSubnetwork `cty:\"subnetwork\"`\n}","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/router.go#L158-L194","documentation":"Returned by RenderGCE when the GCE operation object produced by Routers().Insert() completes with an error, as reported by t.Cloud.WaitForOp(op). The Insert call itself was accepted, but the long-running Google operation failed server-side, so the Cloud Router was not created. The wrapped error contains Google's operation error details.","triggerScenarios":"Routers().Insert succeeds in enqueueing an operation, but WaitForOp polls it and finds status DONE with an error field — e.g. the referenced network/subnet doesn't exist, a router name conflict, or a Google-side failure while creating the router in the region.","commonSituations":"Network/subnet resources not fully propagated (created earlier in the same apply but eventually-consistent on Google's side); invalid network name in cluster spec; router name collides with a manually created router; regional capacity/API incidents.","solutions":["Inspect the wrapped operation error for the specific Google failure reason (e.g. resource not found, already exists)","Verify the VPC network and subnets referenced by the router exist in the target region before applying","If name conflict, delete or rename the pre-existing router in the region (gcloud compute routers list)","Re-run `kops update cluster` once the referenced resources have propagated — this is often transient","Check Google Cloud status / regional incidents if the operation error is an internalError"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Ensure referenced network exists before creating the router\n_, err := compute.Networks.Get(projectID, networkName).Do()\nif err != nil { return fmt.Errorf(\"network %s not found: %w\", networkName, err) }","typeGuard":"func isOpError(op *compute.Operation) bool {\n    return op != nil && op.Status == \"DONE\" && op.Error != nil\n}","tryCatchPattern":"if err := t.Cloud.WaitForOp(op); err != nil {\n    var ge *googleapi.Error\n    if errors.As(err, &ge) {\n        return fmt.Errorf(\"router creation op failed (%d): %w\", ge.Code, err)\n    }\n    return fmt.Errorf(\"error waiting for router creation: %w\", err)\n}","preventionTips":["Wait for network/subnet creation to fully complete before the router task (respect task dependencies)","Avoid manually editing Cloud Routers that kOps manages","Watch operation error details via `gcloud compute operations describe`","Check Google Cloud status page during regional incidents"],"tags":["gce","networking","router","operation-failed"],"backgroundTag":"gcp-operation-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}