{"record":{"id":"351ea10c37c8e0bd","repo":"kubernetes/kops","slug":"disk-not-found-q-v","errorCode":null,"errorMessage":"disk not found %q: %v","messagePattern":"disk not found %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/instance.go","lineNumber":121,"sourceCode":"\t}\n\n\tfor _, serviceAccount := range r.ServiceAccounts {\n\t\tfor _, scope := range serviceAccount.Scopes {\n\t\t\tactual.Scopes = append(actual.Scopes, scopeToShortForm(scope))\n\t\t}\n\t}\n\n\tactual.Disks = make(map[string]*Disk)\n\tfor i, disk := range r.Disks {\n\t\tif i == 0 {\n\t\t\tsource := disk.Source\n\n\t\t\t// TODO: Parse source URL instead of assuming same project/zone?\n\t\t\tname := lastComponent(source)\n\t\t\td, err := cloud.Compute().Disks().Get(cloud.Project(), *e.Zone, name)\n\t\t\tif err != nil {\n\t\t\t\tif gce.IsNotFound(err) {\n\t\t\t\t\treturn nil, fmt.Errorf(\"disk not found %q: %v\", source, err)\n\t\t\t\t}\n\t\t\t\treturn nil, fmt.Errorf(\"error querying for disk %q: %v\", source, err)\n\t\t\t}\n\n\t\t\timage, err := ShortenImageURL(cloud.Project(), d.SourceImage)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error parsing source image URL: %v\", err)\n\t\t\t}\n\t\t\tactual.Image = new(image)\n\t\t} else {\n\t\t\turl, err := gce.ParseGoogleCloudURL(disk.Source)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"unable to parse disk source URL: %q\", disk.Source)\n\t\t\t}\n\n\t\t\tactual.Disks[disk.DeviceName] = &Disk{Name: &url.Name}\n\t\t}\n\t}","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/instance.go#L103-L139","documentation":"In Instance.Find, for the boot disk (source on the same project/zone), kOps does Disks().Get on the disk name parsed from the source URL. If GCE returns NotFound, the attached root disk cannot be found — the instance references a disk that no longer exists — and Find aborts instead of returning partial state.","triggerScenarios":"Disks().Get(project, zone, name) returns IsNotFound: the boot disk was deleted while the instance reference remains (orphaned state), the disk is in a different zone than e.Zone, or state/spec holds a stale disk name.","commonSituations":"Disk manually deleted via console/gcloud while instance state persists in kops state store; instance and disk in mismatched zones after a migration; kops state store drift from manual cluster edits.","solutions":["Recreate the disk or restore the instance so disk and instance agree: `gcloud compute instances describe <name> --zone=<zone>` to see the real disk","Check the disk's actual zone matches e.Zone; if kops state is stale, re-import or update the instance spec","If the instance itself is gone, remove it from the kops state/spec instead of refreshing","Run `kops update cluster` to reconcile after fixing drift"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the boot disk exists in the same zone before refreshing instance state\nname := lastComponent(source)\nif _, err := cloud.Compute().Disks().Get(cloud.Project(), *e.Zone, name); err != nil {\n\treturn fmt.Errorf(\"precheck: boot disk %q missing in zone %s: %w\", name, *e.Zone, err)\n}","typeGuard":"func diskExists(svc *compute.Service, project, zone, name string) bool {\n\t_, err := svc.Disks.Get(project, zone, name).Do()\n\treturn err == nil\n}","tryCatchPattern":null,"preventionTips":["Never delete a GCE disk while instances referencing it are tracked in the kops state store","Keep instance and disk in the same zone; avoid manual zone migrations without updating kops state","Periodically reconcile state: kops update cluster --yes to re-provision drifted resources","Compare kops state with `gcloud compute disks list` to catch drift early"],"tags":["gce","disk","not-found"],"backgroundTag":"gce-resource-not-found","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"}