{"record":{"id":"d91e20aca8f3202f","repo":"hashicorp/nomad","slug":"max-requested-capacity-s-less-than-or-equal-to-d91e20","errorCode":null,"errorMessage":"max requested capacity (%s) less than or equal to current (%s)","messagePattern":"max requested capacity \\((.+?)\\) less than or equal to current \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/csi_endpoint.go","lineNumber":1332,"sourceCode":"\t\treturn nil\n\t}\n\n\t// New values same as current, so nothing to do.\n\tif vol.RequestedCapacityMax == newMax &&\n\t\tvol.RequestedCapacityMin == newMin {\n\t\tlogger.Debug(\"requested capacity unchanged\")\n\t\treturn nil\n\t}\n\n\t// If max is specified, it cannot be less than min or current capacity.\n\tif newMax > 0 {\n\t\tif newMax < newMin {\n\t\t\treturn fmt.Errorf(\"max requested capacity (%s) less than or equal to min (%s)\",\n\t\t\t\thumanize.Bytes(uint64(newMax)),\n\t\t\t\thumanize.Bytes(uint64(newMin)))\n\t\t}\n\t\tif newMax < vol.Capacity {\n\t\t\treturn fmt.Errorf(\"max requested capacity (%s) less than or equal to current (%s)\",\n\t\t\t\thumanize.Bytes(uint64(newMax)),\n\t\t\t\thumanize.Bytes(uint64(vol.Capacity)))\n\t\t}\n\t}\n\n\t// Values are validated, so go ahead and update vol to commit to state,\n\t// even if the external volume does not need expanding.\n\tvol.RequestedCapacityMin = newMin\n\tvol.RequestedCapacityMax = newMax\n\n\t// Only expand if new min is greater than current capacity.\n\tif newMin <= vol.Capacity {\n\t\treturn nil\n\t}\n\n\tif !plugin.HasControllerCapability(structs.CSIControllerSupportsExpand) {\n\t\treturn errors.New(\"expand is not implemented by this controller plugin\")\n\t}","sourceCodeStart":1314,"sourceCodeEnd":1350,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/csi_endpoint.go#L1314-L1350","documentation":"Returned by the CSIVolumeEndpoint.expandVolume RPC when a requested new capacity would shrink or not grow the volume beyond its current provisioned size. CSI controller plugin expansion only supports growing volumes; Nomad validates that the new maximum is strictly greater than the volume's current Capacity and at least the requested minimum before issuing the controller RPC. The error is returned to the client before any state is mutated.","triggerScenarios":"Calling `nomad volume expand <vol> <size>` (or submitting a job/CSIVolume with a larger capacity_max) where the new max is lower than the volume's currently recorded Capacity, or where the new max is less than or equal to the requested capacity_min.","commonSituations":"Typo in byte size (e.g. intending 100GiB but writing 10GiB while the volume already holds 50GiB); operator not realizing a volume was already expanded and re-running the expand with an older/smaller value; attempting to shrink a volume to reclaim storage — CSI has no shrink support; min/max fields swapped in a volume spec.","solutions":["Increase the requested capacity so it is strictly greater than the volume's current Capacity (`nomad volume status <vol>` shows the current capacity).","If you intended to shrink the volume, that is not supported: create a new larger/smaller volume, migrate data, then deregister and delete the old one.","Verify the capacity_min and capacity_max values in the volume spec are not swapped and that max >= min and max > current."],"exampleFix":"# before\nnomad volume expand web-data 10GiB   # volume currently 50GiB -> error\n# after\nnomad volume expand web-data 100GiB","handlingStrategy":"validation","validationCode":"current := vol.Status.CurrentCapacity // or from `nomad volume status -json`\nrequested, _ := units.ParseSize(\"100GiB\")\nif requested <= current {\n    return fmt.Errorf(\"requested %d bytes must exceed current %d bytes; CSI cannot shrink volumes\", requested, current)\n}","typeGuard":"func isShrinkAttempt(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"less than or equal to current\")\n}","tryCatchPattern":null,"preventionTips":["Always fetch current capacity via `nomad volume status <vol>` before expanding.","Remember CSI only supports grow; never script shrink operations.","Validate min <= max and max > current in your automation before calling expand.","Use unambiguous size units (GiB) to avoid unit mistakes."],"tags":["csi","storage","validation","capacity"],"backgroundTag":"csi-volume-capacity-validation","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}