{"record":{"id":"b5241977b478b8b4","repo":"hashicorp/nomad","slug":"volume-parameters-cannot-be-updated","errorCode":null,"errorMessage":"volume parameters cannot be updated","messagePattern":"volume parameters cannot be updated","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/csi.go","lineNumber":855,"sourceCode":"\t}\n\n\t// MountOptions can be updated so long as the volume isn't in use\n\tif v.InUse() {\n\t\tif !v.MountOptions.Equal(other.MountOptions) {\n\t\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\t\"can not update mount options while volume is in use\"))\n\t\t}\n\t} else {\n\t\tv.MountOptions = other.MountOptions\n\t}\n\n\t// Secrets can be updated freely\n\tv.Secrets = other.Secrets\n\n\t// must be compatible with parameters set by from CreateVolumeResponse\n\n\tif len(other.Parameters) != 0 && !maps.Equal(v.Parameters, other.Parameters) {\n\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\"volume parameters cannot be updated\"))\n\t}\n\n\t// Context is mutable and will be used during controller validation, but we\n\t// need to ensure we don't remove context that's been previously stored\n\t// server-side if the user has submitted an update without adding it to the\n\t// spec manually (which we should not require)\n\tif len(other.Context) != 0 {\n\t\tv.Context = other.Context\n\t}\n\treturn errs.ErrorOrNil()\n}\n\n// Request and response wrappers\ntype CSIVolumeRegisterRequest struct {\n\tVolumes   []*CSIVolume\n\tTimestamp int64 // UnixNano\n","sourceCodeStart":837,"sourceCodeEnd":873,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/csi.go#L837-L873","documentation":"Raised by CSIVolume.Merge (nomad/structs/csi.go:855) when a volume update changes the `parameters` map. Volume parameters are passed to the storage provider's CreateVolume call and are baked into the external volume; changing them after creation would contradict what the provider already provisioned, so they are immutable (empty submitted parameters are ignored).","triggerScenarios":"Submitting a volume update where `len(other.Parameters) != 0` and `!maps.Equal(v.Parameters, other.Parameters)` — i.e. non-empty parameters that differ from the registered ones.","commonSituations":"Editing provisioning parameters (e.g. storage class, iops, provisioner keys) in the HCL spec and re-running `nomad volume update`; environment-specific templating injecting different parameters; typo fixes to parameter keys resubmitted as updates.","solutions":["Remove or keep parameters identical in the update spec — omitting them entirely (empty map) bypasses the check","Deregister and re-register the volume (optionally creating a new external volume) if the parameters must change","Diff the volume spec against the registered volume before submitting updates"],"exampleFix":"// before\nparameters = {\n  provisioning = \"thick\" # differs from registered 'thin'\n}\n// after\n# parameters omitted from update; immutable after creation\nvolume \"data\" {\n  type = \"csi\"\n}","handlingStrategy":"validation","validationCode":"if len(update.Parameters) != 0 && !maps.Equal(existing.Parameters, update.Parameters) {\n    return errors.New(\"parameters are immutable; remove them from the update or create a new volume\")\n}","typeGuard":"func parametersMutable(existing, update *structs.CSIVolume) bool {\n    return len(update.Parameters) == 0 || maps.Equal(existing.Parameters, update.Parameters)\n}","tryCatchPattern":null,"preventionTips":["Strip or keep-identical parameters blocks in update specs; only secrets, context, and capabilities are mutable","Treat parameters as provisioning-time configuration documented alongside the volume","Use `nomad volume inspect` to compare parameters before submitting updates"],"tags":["csi","nomad","volume","parameters","immutable-field"],"backgroundTag":"immutable-field-update-rejected","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"}