{"record":{"id":"4a95aa1e0835aec8","repo":"portainer/portainer","slug":"unable-to-get-storage-class-s-error-w","errorCode":null,"errorMessage":"unable to get storage class %s. Error: %w","messagePattern":"unable to get storage class (.+?)\\. Error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/kubernetes/cli/persistent_volume_claims.go","lineNumber":119,"sourceCode":"\t\t\treturn fmt.Errorf(\"unable to delete persistent volume claim %s/%s. Error: %w\", req.Namespace, req.Name, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// ResizePersistentVolumeClaim resizes a PVC to the given new size.\n// The storage class must have AllowVolumeExpansion set to true.\nfunc (kcl *KubeClient) ResizePersistentVolumeClaim(namespace, name, newSize string) error {\n\tpvc, err := kcl.cli.CoreV1().PersistentVolumeClaims(namespace).Get(context.Background(), name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to get persistent volume claim %s/%s. Error: %w\", namespace, name, err)\n\t}\n\n\tif pvc.Spec.StorageClassName != nil {\n\t\tsc, err := kcl.GetStorageClass(*pvc.Spec.StorageClassName)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to get storage class %s. Error: %w\", *pvc.Spec.StorageClassName, err)\n\t\t}\n\n\t\tif sc.AllowVolumeExpansion == nil || !*sc.AllowVolumeExpansion {\n\t\t\treturn errors.New(\"storage class \" + sc.Name + \" does not allow volume expansion\")\n\t\t}\n\t}\n\n\t_, err = resource.ParseQuantity(newSize)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid size format %q. Error: %w\", newSize, err)\n\t}\n\n\tpatch := fmt.Sprintf(`{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"%s\"}}}}`, newSize)\n\n\t_, err = kcl.cli.CoreV1().PersistentVolumeClaims(namespace).Patch(\n\t\tcontext.Background(),\n\t\tname,\n\t\ttypes.MergePatchType,","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/kubernetes/cli/persistent_volume_claims.go#L101-L137","documentation":"Error \"unable to get storage class %s. Error: %w\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/kubernetes/cli/persistent_volume_claims.go:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}