hashicorp/nomad · error

cannot update a volume in use: claimed by allocs (%s)

Error message

cannot update a volume in use: claimed by allocs (%s)

What it means

ValidateUpdate refuses to modify a host volume that currently has active allocations claiming it. The existing volume's Allocations list is checked; any alloc IDs present mean the volume is in use and updates are blocked to avoid breaking running workloads.

Source

Thrown at nomad/structs/host_volumes.go:184

		default:
		}
	}

	return helper.FlattenMultierror(mErr.ErrorOrNil())
}

// ValidateUpdate verifies that an update to a volume is safe to make.
func (hv *HostVolume) ValidateUpdate(existing *HostVolume) error {
	if existing == nil {
		return nil
	}

	var mErr *multierror.Error
	if len(existing.Allocations) > 0 {
		allocIDs := helper.ConvertSlice(existing.Allocations,
			func(a *AllocListStub) string { return a.ID })
		mErr = multierror.Append(mErr, fmt.Errorf(
			"cannot update a volume in use: claimed by allocs (%s)",
			strings.Join(allocIDs, ", ")))
	}

	if hv.NodeID != "" && hv.NodeID != existing.NodeID {
		mErr = multierror.Append(mErr, errors.New("node ID cannot be updated"))
	}
	if hv.NodePool != "" && hv.NodePool != existing.NodePool {
		mErr = multierror.Append(mErr, errors.New("node pool cannot be updated"))
	}

	if hv.RequestedCapacityMaxBytes > 0 &&
		hv.RequestedCapacityMaxBytes < existing.CapacityBytes {
		mErr = multierror.Append(mErr, fmt.Errorf(
			"capacity_max (%d) cannot be less than existing provisioned capacity (%d)",
			hv.RequestedCapacityMaxBytes, existing.CapacityBytes))
	}

	return mErr.ErrorOrNil()

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Stop/drain the jobs whose allocs claim the volume, wait for allocs to be removed, then update the volume
  2. Register a new host volume with a different name and migrate workloads to it
  3. Verify with 'nomad volume status' which allocations hold the volume
Defensive patterns

Strategy: validation

Validate before calling

status, _, err := client.CSIVolumes().Info(volumeID)
if err == nil && len(status.Allocations) > 0 {
  return fmt.Errorf("volume %s in use by %d allocs; stop jobs first", volumeID, len(status.Allocations))
}

Try / catch

if err := updateVolume(hv); err != nil {
  if strings.Contains(err.Error(), "cannot update a volume in use") {
    // stop claiming jobs, wait, then retry
  }
}

Prevention

When it happens

Trigger: Submitting a host volume update (CSIVolume register or HostVolume update RPC via validateVolumeUpdate) where existing.Allocations is non-empty.

Common situations: Trying to change capacity, node, or parameters of a volume while jobs using it are still running; CI pipelines that re-register volumes on every deploy.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/493a5e95eccea4f3. Report an issue: GitHub.