{"record":{"id":"05d8ecc7c9f2a12f","repo":"hashicorp/nomad","slug":"volume-clone-id-cannot-be-updated","errorCode":null,"errorMessage":"volume clone ID cannot be updated","messagePattern":"volume clone ID cannot be updated","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/csi.go","lineNumber":801,"sourceCode":"\tif other == nil {\n\t\treturn nil\n\t}\n\n\tvar errs *multierror.Error\n\n\tif v.Name != other.Name && other.Name != \"\" {\n\t\terrs = multierror.Append(errs, errors.New(\"volume name cannot be updated\"))\n\t}\n\tif v.ExternalID != other.ExternalID && other.ExternalID != \"\" {\n\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\"volume external ID cannot be updated\"))\n\t}\n\tif v.PluginID != other.PluginID {\n\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\"volume plugin ID cannot be updated\"))\n\t}\n\tif v.CloneID != other.CloneID && other.CloneID != \"\" {\n\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\"volume clone ID cannot be updated\"))\n\t}\n\tif v.SnapshotID != other.SnapshotID && other.SnapshotID != \"\" {\n\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\"volume snapshot ID cannot be updated\"))\n\t}\n\n\t// must be compatible with volume_capabilities\n\tif v.AccessMode != CSIVolumeAccessModeUnknown ||\n\t\tv.AttachmentMode != CSIVolumeAttachmentModeUnknown {\n\t\tvar ok bool\n\t\tfor _, cap := range other.RequestedCapabilities {\n\t\t\tif cap.AccessMode == v.AccessMode &&\n\t\t\t\tcap.AttachmentMode == v.AttachmentMode {\n\t\t\t\tok = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}","sourceCodeStart":783,"sourceCodeEnd":819,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/csi.go#L783-L819","documentation":"This error is produced by CSIVolume.Merge (nomad/structs/csi.go:782) when a `nomad volume update` (or any volume registration merge) tries to change the clone ID of an existing CSI volume. Nomad treats the clone ID (the source volume/snapshot a volume was cloned from) as an immutable user-defined field once the volume has been created. All immutable-field violations are collected into a hashicorp/go-multierror and returned as one 'validation: ...' error.","triggerScenarios":"Calling the CSIVolume.Merge method (via the VolumeUpsert/update RPC path) with `other.CloneID` different from the stored volume's CloneID while `other.CloneID != \"\"` — i.e. an update spec that sets a non-empty clone ID that differs from the registered volume.","commonSituations":"Hand-editing or regenerating a volume spec HCL/JSON that originally included a clone source and resubmitting it with a different clone ID; templating the volume spec so the clone ID varies between environments; copy-pasting a spec from a different volume.","solutions":["Remove the `clone_id` (or clone/source stanza) from the update spec — an empty CloneID is silently ignored by Merge, so updates pass when the field is omitted","If a different clone source is truly needed, deregister the volume (and destroy the external volume if desired) and register a new volume with the new clone ID","Keep the volume spec in version control and ensure the clone ID field never changes between submits"],"exampleFix":"// before (update spec)\nvolume \"data\" {\n  clone_id = \"abc-123\"\n}\n// after (update spec omits the immutable field)\nvolume \"data\" {\n  # clone_id omitted; only mutable fields (secrets, context, capabilities) updated\n}","handlingStrategy":"validation","validationCode":"// before submitting a volume update\nif other.CloneID != \"\" && existing.CloneID != other.CloneID {\n    return fmt.Errorf(\"clone ID %q differs from registered %q; omit it from updates\", other.CloneID, existing.CloneID)\n}","typeGuard":"func cloneIDMutable(existing, update *structs.CSIVolume) bool {\n    return update.CloneID == \"\" || update.CloneID == existing.CloneID\n}","tryCatchPattern":null,"preventionTips":["Never include immutable fields (clone_id, snapshot_id, external_id, parameters) in volume update specs","Keep volume specs in version control and diff before resubmitting","Treat 'validation: ...' multierror messages as field-by-field immutability reports"],"tags":["csi","nomad","volume","immutable-field","validation"],"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"}