{"record":{"id":"7fd09ccfeb6464fd","repo":"kubernetes/kops","slug":"error-setting-labels-on-created-disk-v","errorCode":null,"errorMessage":"error setting labels on created Disk: %v","messagePattern":"error setting labels on created Disk: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/disk.go","lineNumber":162,"sourceCode":"\t\td, err := cloud.Compute().Disks().Get(t.Cloud.Project(), *e.Zone, disk.Name)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading created Disk: %v\", err)\n\t\t}\n\n\t\tlabelsRequest := &compute.ZoneSetLabelsRequest{\n\t\t\tLabelFingerprint: d.LabelFingerprint,\n\t\t\tLabels:           make(map[string]string),\n\t\t}\n\t\t// Danger: labels replace tags on instances; but thankfully volumes don't have tags\n\t\t//for _, k := range d.Tags {\n\t\t//\tlabelsRequest.Labels[k] = \"\"\n\t\t//}\n\t\tmaps.Copy(labelsRequest.Labels, d.Labels)\n\t\tmaps.Copy(labelsRequest.Labels, t.Cloud.Labels())\n\t\tmaps.Copy(labelsRequest.Labels, e.Labels)\n\t\tklog.V(2).Infof(\"Setting labels on disk %q: %v\", disk.Name, labelsRequest.Labels)\n\t\tif err = t.Cloud.Compute().Disks().SetLabels(t.Cloud.Project(), *e.Zone, disk.Name, labelsRequest); err != nil {\n\t\t\treturn fmt.Errorf(\"error setting labels on created Disk: %v\", err)\n\t\t}\n\t\tchanges.Labels = nil\n\t}\n\n\tif a != nil && changes != nil {\n\t\tempty := &Disk{}\n\t\tif !reflect.DeepEqual(empty, changes) {\n\t\t\treturn fmt.Errorf(\"cannot apply changes to Disk: %v\", changes)\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype terraformDisk struct {\n\tName                  *string           `cty:\"name\"`\n\tVolumeType            *string           `cty:\"type\"`\n\tSizeGB                *int64            `cty:\"size\"`","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/disk.go#L144-L180","documentation":"When labels must be applied to a newly created disk, kOps calls Disks().SetLabels with the merged fingerprint/labels; this error wraps a failure of that call. The disk exists, but labeling could not be applied.","triggerScenarios":"changes.Labels != nil and cloud.Compute().Disks().Disks().SetLabels(project, zone, disk.Name, labelsRequest) fails — commonly a LabelFingerprint conflict because the disk's labels changed concurrently.","commonSituations":"Another process modified disk labels between Get and SetLabels (stale fingerprint); insufficient compute.disks.setLabels IAM permission; concurrent kops runs against the same cluster.","solutions":["Re-run kops update to fetch a fresh LabelFingerprint and retry","Ensure only one kops update runs at a time","Grant the service account compute.disks.setLabels / compute.disks.update IAM role","Check the wrapped error for ablfingerprint-mismatch and retry after the conflicting writer finishes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// fetch fresh fingerprint immediately before SetLabels\nd, err := computeService.Disks.Get(project, zone, name).Do()\nreq := &compute.ZoneSetLabelsRequest{LabelFingerprint: d.LabelFingerprint, Labels: merged}","typeGuard":null,"tryCatchPattern":"if err := setLabels(...); err != nil {\n  if isFingerprintConflict(err) { time.Sleep(backoff); reGetAndRetry() }\n  return err\n}","preventionTips":["Never cache LabelFingerprint across reconcile passes","Serialize label writers (single kops controller)","Grant compute.disks.setLabels IAM explicitly"],"tags":["gcp","gce","disk","labels"],"backgroundTag":"label-fingerprint-conflict","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"}