{"record":{"id":"6206c06a02b09667","repo":"kubernetes/kops","slug":"cloud-cannot-be-nil","errorCode":null,"errorMessage":"cloud cannot be nil","messagePattern":"cloud cannot be nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/defaults.go","lineNumber":70,"sourceCode":"\n\tfor i := range c.Spec.EtcdClusters {\n\t\tetcdCluster := &c.Spec.EtcdClusters[i]\n\t\tif etcdCluster.Manager == nil {\n\t\t\tetcdCluster.Manager = &kops.EtcdManagerSpec{}\n\t\t}\n\t\tif etcdCluster.Manager.BackupRetentionDays == nil {\n\t\t\tetcdCluster.Manager.BackupRetentionDays = new(uint32(90))\n\t\t}\n\t}\n\n\t// Topology support\n\t// TODO Kris: Unsure if this needs to be here, or if the API conversion code will handle it\n\tif c.Spec.Networking.Topology == nil {\n\t\tc.Spec.Networking.Topology = &kops.TopologySpec{}\n\t}\n\n\tif cloud == nil {\n\t\treturn fmt.Errorf(\"cloud cannot be nil\")\n\t}\n\n\tif cloud.ProviderID() == kops.CloudProviderGCE {\n\t\tif err := gce.PerformNetworkAssignments(ctx, c, cloud); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif cloud.ProviderID() == kops.CloudProviderAWS && c.Spec.Networking.NetworkCIDR == \"\" {\n\t\tif c.SharedVPC() {\n\t\t\tvpcInfo, err := cloud.FindVPCInfo(c.Spec.Networking.NetworkID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif vpcInfo == nil {\n\t\t\t\treturn fmt.Errorf(\"unable to find Network ID %q\", c.Spec.Networking.NetworkID)\n\t\t\t}\n\t\t\tc.Spec.Networking.NetworkCIDR = vpcInfo.CIDR","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/defaults.go#L52-L88","documentation":"Defensive nil-check sentinel in PerformAssignments: the cloud interface argument is nil, so no cloud-specific defaults (network CIDRs, etcd, etc.) can be applied. Indicates a programming error in the caller — all listed callers (create/update/replace cluster flows) must pass an initialized cloud implementation.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/defaults.go:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure BuildCloud/cloud discovery succeeded before calling PerformAssignments","Check the --cloud/provider flag produced a valid cloud instance","Report as a bug if a valid cloud was expected"],"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"}