hashicorp/nomad · error

no volumes with prefix or ID %q found

Error message

no volumes with prefix or ID %q found

What it means

Returned by getHostVolumeByPrefix when the prefix/ID query matched zero host volumes in the namespace — the requested volume does not exist (or is in another namespace).

Source

Thrown at command/volume_status_host.go:93

	if err != nil {
		return fmt.Errorf("Error formatting host volumes: %w", err)
	}
	c.Ui.Output(c.Colorize().Color(str))
	return nil
}

func getHostVolumeByPrefix(client *api.Client, prefix, ns string) (*api.HostVolumeStub, []*api.HostVolumeStub, error) {
	vols, _, err := client.HostVolumes().List(nil, &api.QueryOptions{
		Prefix:    prefix,
		Namespace: ns,
	})

	if err != nil {
		return nil, nil, fmt.Errorf("error querying volumes: %w", err)
	}
	switch len(vols) {
	case 0:
		return nil, nil, fmt.Errorf("no volumes with prefix or ID %q found", prefix)
	case 1:
		return vols[0], nil, nil
	default:
		// search for exact matches to account for multiple exact ID or name
		// matches across namespaces
		var match *api.HostVolumeStub
		exactMatchesCount := 0
		for _, vol := range vols {
			if vol.ID == prefix || vol.Name == prefix {
				exactMatchesCount++
				match = vol
			}
		}
		if exactMatchesCount == 1 {
			return match, nil, nil
		}
		return nil, vols, nil
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check the volume ID/prefix spelling and namespace
  2. Run nomad volume status (list) to see existing volumes
  3. Create the volume if it does not yet exist
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at command/volume_status_host.go:93 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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