hashicorp/nomad · warning

Prefix matched multiple CSI volumes %s

Error message

Prefix matched multiple CSI volumes

%s

What it means

If the prefix given to `nomad volume status` matches multiple CSI volumes, the command does not pick one; instead it renders the matching list and returns `Prefix matched multiple CSI volumes\n\n<table>` as an error to show the user the candidates. It is a deliberate disambiguation prompt, not an internal failure.

Source

Thrown at command/volume_status_csi.go:39

	}

	// get a CSI volume that matches the given prefix or a list of all matches if an
	// exact match is not found.
	volStub, possible, err := getByPrefix[api.CSIVolumeListStub]("volumes", client.CSIVolumes().List,
		func(vol *api.CSIVolumeListStub, prefix string) bool { return vol.ID == prefix },
		&api.QueryOptions{
			Prefix:    id,
			Namespace: c.namespace,
		})
	if err != nil {
		return fmt.Errorf("Error listing CSI volumes: %w", err)
	}
	if len(possible) > 0 {
		out, err := csiFormatVolumes(possible, c.json, c.template)
		if err != nil {
			return fmt.Errorf("Error formatting: %w", err)
		}
		return fmt.Errorf("Prefix matched multiple CSI volumes\n\n%s", out)
	}

	// Try querying the volume
	vol, _, err := client.CSIVolumes().Info(volStub.ID, nil)
	if err != nil {
		return fmt.Errorf("Error querying CSI volume: %w", err)
	}

	str, err := c.formatCSIBasic(vol)
	if err != nil {
		return fmt.Errorf("Error formatting CSI volume: %w", err)
	}
	c.Ui.Output(str)
	return nil
}

func (c *VolumeStatusCommand) csiVolumesList(client *api.Client, opts formatOpts) error {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Re-run with a longer prefix or the full volume ID so exactly one volume matches.
  2. Pick the exact ID from the table the command prints below the message.
  3. Use `nomad volume status` with no argument to browse all volumes and find the exact ID.

Example fix

// before
nomad volume status web
// after
nomad volume status web-data
Defensive patterns

Strategy: validation

Validate before calling

// resolve to exactly one volume before status
matches, _, err := client.CSIVolumes().List(&api.QueryOptions{Prefix: prefix})
if err != nil { return err }
if len(matches) != 1 {
	ids := make([]string, len(matches))
	for i, m := range matches { ids[i] = m.ID }
	return fmt.Errorf("prefix %q matched %d volumes: %v", prefix, len(matches), ids)
}

Try / catch

err := cmd.Run()
if err != nil && strings.Contains(err.Error(), "Prefix matched multiple CSI volumes") {
	// parse the printed table and rerun with a longer prefix
}

Prevention

When it happens

Trigger: `nomad volume status <short-prefix>` where List with that Prefix returns 2+ CSIVolumeListStub entries.

Common situations: Short human-friendly volume names sharing a prefix (e.g. 'web-cache', 'web-data'); copy-pasting only part of a UUID.

Related errors


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