{"record":{"id":"863b0c2452774add","repo":"kubernetes/kubernetes","slug":"pvc-has-empty-pvc-spec-volumename","errorCode":null,"errorMessage":"PVC has empty pvc.Spec.VolumeName","messagePattern":"PVC has empty pvc\\.Spec\\.VolumeName","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go","lineNumber":553,"sourceCode":"\t// that can happen is that such pod is scheduled. This was the default\n\t// behavior in 1.8 and earlier and users should not be that surprised.\n\t// It should happen only in very rare case when scheduler schedules\n\t// a pod and user deletes a PVC that's used by it at the same time.\n\t//\n\t// 2) Adding a check for kubernetes.io/pvc-protection here to prevent\n\t// the existing running pods from being affected during the rebuild of\n\t// the desired state of the world cache when the kubelet is restarted.\n\t// It is safe for kubelet to add this check here because the PVC will\n\t// be stuck in Terminating state until the pod is deleted.\n\tif pvc.ObjectMeta.DeletionTimestamp != nil && !slices.Contains(pvc.Finalizers, util.PVCProtectionFinalizer) {\n\t\treturn nil, errors.New(\"PVC is being deleted\")\n\t}\n\n\tif pvc.Status.Phase != v1.ClaimBound {\n\t\treturn nil, errors.New(\"PVC is not bound\")\n\t}\n\tif pvc.Spec.VolumeName == \"\" {\n\t\treturn nil, errors.New(\"PVC has empty pvc.Spec.VolumeName\")\n\t}\n\n\treturn pvc, nil\n}\n\n// getPVSpec fetches the PV object with the given name from the API server\n// and returns a volume.Spec representing it.\n// An error is returned if the call to fetch the PV object fails.\nfunc (dswp *desiredStateOfWorldPopulator) getPVSpec(\n\tctx context.Context,\n\tname string,\n\tpvcReadOnly bool,\n\texpectedClaimUID types.UID) (*volume.Spec, string, error) {\n\tpv, err := dswp.kubeClient.CoreV1().PersistentVolumes().Get(ctx, name, metav1.GetOptions{})\n\tif err != nil || pv == nil {\n\t\treturn nil, \"\", fmt.Errorf(\n\t\t\t\"failed to fetch PV %s from API server: %v\", name, err)\n\t}","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go#L535-L571","documentation":"Returned by getPVCExtractPV when a PVC is marked Bound but its Spec.VolumeName is empty. A bound claim must reference a PV name; an empty one is corrupt/inconsistent state that the volume manager cannot resolve to a PV.","triggerScenarios":"Returned at desired_state_of_world_populator.go:553 when pvc.Spec.VolumeName == \"\". Hit after the Bound-phase check passes.","commonSituations":"Corrupted PVC object (controller bug, failed binding mid-write), an external provisioner that set phase=Bound without setting VolumeName, or recovery from a bad etcd state.","solutions":["Inspect the PVC: kubectl get pvc <name> -o yaml; confirm spec.volumeName is truly empty.","Delete and recreate the PVC so the binder/provisioner reconciles it cleanly.","Check the persistent-volume-controller and provisioner logs for the binding failure.","If a PV exists, manually set the claim's spec.volumeName (advanced) or recreate both."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate a bound PVC actually references a PV name.\nfunc pvcHasVolume(pvc *corev1.PersistentVolumeClaim) bool {\n    return pvc.Status.Phase == corev1.ClaimBound && pvc.Spec.VolumeName != \"\"\n}","typeGuard":"func isPVCEmptyVolumeName(err error) bool {\n    return err != nil && err.Error() == \"PVC has empty pvc.Spec.VolumeName\"\n}","tryCatchPattern":"// This is corrupt state, not transient. Recreate the PVC rather than retrying blindly.\nif _, err := getPVCExtractPV(...); err != nil {\n    if isPVCEmptyVolumeName(err) { /* recreate PVC; investigate binder */ }\n}","preventionTips":["Treat Bound+empty VolumeName as data corruption; recreate the claim.","Keep the PV controller / external-provisioner healthy.","Avoid manually patching PVC phase to Bound."],"tags":["kubelet","volume","pvc","data-integrity","volume-manager"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}