hashicorp/nomad · error

missing Name

Error message

missing Name

What it means

ControllerCreateVolumeRequest.Validate() rejects requests with an empty Name. Name identifies the volume being created and is used for idempotency and provider-side labeling. An empty name means the caller never labeled the volume request, so creation is refused.

Source

Thrown at plugins/csi/plugin.go:494

	for _, cap := range r.VolumeCapabilities {
		caps = append(caps, cap.ToCSIRepresentation())
	}
	req := &csipbv1.CreateVolumeRequest{
		Name:                      r.Name,
		CapacityRange:             r.CapacityRange.ToCSIRepresentation(),
		VolumeCapabilities:        caps,
		Parameters:                r.Parameters,
		Secrets:                   r.Secrets,
		VolumeContentSource:       r.ContentSource.ToCSIRepresentation(),
		AccessibilityRequirements: r.AccessibilityRequirements.ToCSIRepresentation(),
	}

	return req
}

func (r *ControllerCreateVolumeRequest) Validate() error {
	if r.Name == "" {
		return errors.New("missing Name")
	}
	if r.VolumeCapabilities == nil {
		return errors.New("missing VolumeCapabilities")
	}
	if r.CapacityRange != nil {
		if r.CapacityRange.LimitBytes == 0 && r.CapacityRange.RequiredBytes == 0 {
			return errors.New(
				"one of LimitBytes or RequiredBytes must be set if CapacityRange is set")
		}
		if r.CapacityRange.LimitBytes > 0 &&
			r.CapacityRange.LimitBytes < r.CapacityRange.RequiredBytes {
			return errors.New("LimitBytes cannot be less than RequiredBytes")
		}
	}
	if r.ContentSource != nil {
		if r.ContentSource.CloneID != "" && r.ContentSource.SnapshotID != "" {
			return errors.New(
				"one of SnapshotID or CloneID must be set if ContentSource is set")

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set Name to a unique, stable identifier for the volume (e.g. the claim/volume ID) before calling
  2. Ensure the volume spec/claim object carries a non-empty name through to the request builder
  3. Check template rendering or ID generation that may produce an empty string

Example fix

// before
req := &csi.ControllerCreateVolumeRequest{
    VolumeCapabilities: caps,
}
// after
req := &csi.ControllerCreateVolumeRequest{
    Name:               "vol-" + claim.ID,
    VolumeCapabilities: caps,
}
Defensive patterns

Strategy: validation

Validate before calling

func validateCreateVolume(req *csi.ControllerCreateVolumeRequest) error {
    if req.Name == "" {
        return errors.New("Name must be a unique, stable volume identifier")
    }
    return nil
}

Type guard

func hasName(req *csi.ControllerCreateVolumeRequest) bool {
    return req != nil && req.Name != ""
}

Try / catch

if err := req.Validate(); err != nil {
    if strings.Contains(err.Error(), "missing Name") {
        return fmt.Errorf("create refused: assign a unique name (e.g. claim ID) to the volume request: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling ControllerCreateVolume (via NodePublishVolume-driven creation flows) with Name empty, e.g. a zero-value request or a volume spec whose name field was never filled.

Common situations: Orchestrator code generating volumes without assigning a unique name; config/job templates missing the volume name; programmatic volume provisioning in tests using zero-value structs.

Related errors


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