{"record":{"id":"c4650e812b48a3da","repo":"kubernetes/kops","slug":"building-full-cluster-spec-w","errorCode":null,"errorMessage":"building full cluster spec: %w","messagePattern":"building full cluster spec: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/toolbox_enroll.go","lineNumber":535,"sourceCode":"\tassetBuilder, err := b.GetAssetBuilder(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstanceGroupList, err := b.GetInstanceGroups(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar instanceGroups []*kops.InstanceGroup\n\tfor i := range instanceGroupList.Items {\n\t\tinstanceGroup := &instanceGroupList.Items[i]\n\t\tinstanceGroups = append(instanceGroups, instanceGroup)\n\t}\n\n\tfullCluster, err := cloudup.PopulateClusterSpec(ctx, clientset, cluster, instanceGroups, cloud, assetBuilder)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"building full cluster spec: %w\", err)\n\t}\n\tb.fullCluster = fullCluster\n\treturn fullCluster, nil\n}\n\nfunc (b *ConfigBuilder) GetInstanceGroup(ctx context.Context) (*kops.InstanceGroup, error) {\n\tif b.InstanceGroup != nil {\n\t\treturn b.InstanceGroup, nil\n\t}\n\n\tinstanceGroups, err := b.GetInstanceGroups(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif b.InstanceGroupName == \"\" {\n\t\treturn nil, fmt.Errorf(\"InstanceGroup name is missing\")\n\t}","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/commands/toolbox_enroll.go#L517-L553","documentation":"GetFullCluster calls cloudup.PopulateClusterSpec to fully populate/validate the cluster spec (defaults, cloud-specific fields) and wraps any failure. This means the cluster spec from the state store could not be reconciled against the cloud and instance groups.","triggerScenarios":"PopulateClusterSpec returns an error: invalid or missing fields in the cluster manifest, cloud API failures (auth, quota, region), unsupported kubernetes version, or inconsistent instance groups.","commonSituations":"Cluster spec edited by hand with invalid values; cloud credentials expired/missing; kops version newer than the spec supports; deleting cloud resources referenced by the cluster (subnets/VPC).","solutions":["Read the wrapped root cause (%w chain) — it names the specific spec field or cloud error","Validate the cluster: kops replace/apply with --dry-run or `kops toolbox template` to surface spec errors","Refresh cloud credentials and confirm the cloud API is reachable","Upgrade/align the cluster spec (kops upgrade cluster) if versions are mismatched"],"exampleFix":"// before\nfullCluster, err := b.GetFullCluster(ctx) // opaque spec error\n// after\nif err != nil {\n    var root error\n    for errors.Unwrap(err) != nil { root = errors.Unwrap(err) }\n    log.Printf(\"populate failed, root cause: %v\", root)\n}","handlingStrategy":"try-catch","validationCode":"// validate spec before populating\nif err := cluster.Validate(false); err != nil { return fmt.Errorf(\"invalid cluster spec: %w\", err) }","typeGuard":"func isSpecPopulationError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"building full cluster spec\")\n}","tryCatchPattern":"full, err := b.GetFullCluster(ctx)\nif isSpecPopulationError(err) {\n    return fmt.Errorf(\"fix cluster spec / cloud access (see wrapped cause): %w\", err)\n}","preventionTips":["Validate the cluster spec after manual edits","Keep cloud credentials fresh","Run `kops upgrade cluster` when upgrading kops","Avoid deleting cloud resources referenced by the spec"],"tags":["cluster-spec","validation","cloud"],"backgroundTag":"cluster-spec-population-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"}