{"record":{"id":"d6d3b55898fbe776","repo":"hashicorp/nomad","slug":"missing-volume-id-to-delete","errorCode":null,"errorMessage":"missing volume ID to delete","messagePattern":"missing volume ID to delete","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/host_volume_endpoint.go","lineNumber":683,"sourceCode":"\t) {\n\t\treturn fmt.Errorf(\n\t\t\t\"all servers should be running version %v or later to use dynamic host volumes\",\n\t\t\tminVersionDynamicHostVolumes,\n\t\t)\n\t}\n\n\t// Note that all deleted volumes need to be in the same namespace\n\tallowVolume := acl.NamespaceValidator(acl.NamespaceCapabilityHostVolumeDelete)\n\taclObj, err := v.srv.ResolveACL(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !allowVolume(aclObj, args.RequestNamespace()) {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\tif args.VolumeID == \"\" {\n\t\treturn fmt.Errorf(\"missing volume ID to delete\")\n\t}\n\n\tsnap, err := v.srv.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tns := args.RequestNamespace()\n\tid := args.VolumeID\n\n\tvol, err := snap.HostVolumeByID(nil, ns, id, true)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not query host volume: %w\", err)\n\t}\n\tif vol == nil {\n\t\treturn fmt.Errorf(\"no such volume: %s\", id)\n\t}\n\tif len(vol.Allocations) > 0 {","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/host_volume_endpoint.go#L665-L701","documentation":"HostVolume.Delete requires args.VolumeID to identify which host volume to remove. If the delete request carries an empty VolumeID (after ACL and namespace checks), the server rejects it with this plain input-validation error instead of attempting a state lookup.","triggerScenarios":"Sending a HostVolumeDeleteRequest with VolumeID left unset — e.g. CLI/SDK call where the ID variable was empty, templating failed to interpolate the volume name, or a script passed an unset shell variable.","commonSituations":"Shell scripts with `nomad host volume delete \"$VOL_ID\"` where VOL_ID is empty; CI pipelines where a previous step failed to export the ID; copy-pasted API calls missing the id field in JSON.","solutions":["Supply the volume ID: `nomad host volume delete <volume-id>`.","Fix the script/templating so the ID variable is populated before the call.","Verify with `nomad host volume status <name>` which ID corresponds to the volume."],"exampleFix":"// before\nnomad host volume delete \"$VOL_ID\"   # VOL_ID unset\n// after\nVOL_ID=$(nomad host volume status -json my-vol | jq -r '.ID')\nnomad host volume delete \"$VOL_ID\"","handlingStrategy":"validation","validationCode":"if volID == \"\" {\n    return fmt.Errorf(\"volume ID required; got empty value from $VOL_ID\")\n}\n// CLI: [ -n \"$VOL_ID\" ] && nomad host volume delete \"$VOL_ID\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `set -u` in shell scripts to catch unset variables.","Resolve IDs via `nomad host volume status` before delete calls.","Fail fast in CI when an ID-producing step outputs nothing."],"tags":["nomad","host-volumes","missing-argument","input-validation"],"backgroundTag":"missing-required-argument","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"}