hashicorp/nomad · error

missing VolumeID

Error message

missing VolumeID

What it means

This error is returned by ControllerCreateSnapshotRequest.Validate when VolumeID is empty. Creating a snapshot requires identifying the source volume by its provider-assigned ID; without it the snapshot has no target, so the request is rejected locally before the ControllerCreateSnapshot gRPC call.

Source

Thrown at plugins/csi/plugin.go:774

type ControllerCreateSnapshotRequest struct {
	VolumeID   string
	Name       string
	Secrets    structs.CSISecrets
	Parameters map[string]string
}

func (r *ControllerCreateSnapshotRequest) ToCSIRepresentation() *csipbv1.CreateSnapshotRequest {
	return &csipbv1.CreateSnapshotRequest{
		SourceVolumeId: r.VolumeID,
		Name:           r.Name,
		Secrets:        r.Secrets,
		Parameters:     r.Parameters,
	}
}

func (r *ControllerCreateSnapshotRequest) Validate() error {
	if r.VolumeID == "" {
		return errors.New("missing VolumeID")
	}
	if r.Name == "" {
		return errors.New("missing Name")
	}
	return nil
}

type ControllerCreateSnapshotResponse struct {
	Snapshot *Snapshot
}

type Snapshot struct {
	ID             string
	SourceVolumeID string
	SizeBytes      int64
	CreateTime     int64
	IsReady        bool
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Populate VolumeID with the provider-assigned external volume ID before snapshotting.
  2. Verify the source volume exists via nomad volume status and copy its external ID.
  3. Guard the snapshot job to wait until the volume is fully registered/published.
  4. Validate VolumeID non-empty at the automation layer with a clearer message.

Example fix

// before
snap := &ControllerCreateSnapshotRequest{Name: "nightly"}
// after
snap := &ControllerCreateSnapshotRequest{
  VolumeID: vol.ExternalID,
  Name:     "nightly",
}
Defensive patterns

Strategy: validation

Validate before calling

if req.VolumeID == "" {
	return fmt.Errorf("cannot snapshot: source volume ID is required")
}

Type guard

func snapshotTargetSet(r *ControllerCreateSnapshotRequest) bool {
	return r != nil && r.VolumeID != "" && r.Name != ""
}

Prevention

When it happens

Trigger: Calling the create-snapshot path with ControllerCreateSnapshotRequest{VolumeID: "", Name: "snap1"} — e.g. the volume ID variable was empty because the volume was never created/published, or the request struct was built without setting VolumeID.

Common situations: Snapshot automation running before volume registration completed; a lookup of the volume by name returning an empty ID that was passed through unvalidated; templating an ID from an unset Nomad variable.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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