hashicorp/nomad · error

Error querying CSI volume: %w

Error message

Error querying CSI volume: %w

What it means

After the prefix match resolves to a single volume, csiVolumeStatus calls client.CSIVolumes().Info(volStub.ID) to fetch the full volume. Any API error (deleted volume between list and info, ACL denial, network failure) is wrapped as `Error querying CSI volume`.

Source

Thrown at command/volume_status_csi.go:45

		&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 {

	if !(opts.json || len(opts.template) > 0) {
		c.Ui.Output(c.Colorize().Color("[bold]Container Storage Interface[reset]"))
	}

	vols, _, err := client.CSIVolumes().List(nil)
	if err != nil {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the wrapped cause: re-register the volume if it was deregistered, or retry if transient.
  2. Confirm the ACL token can read volumes in the volume's namespace.
  3. Verify the volume still exists with `nomad volume status` (list) and use its current ID.
Defensive patterns

Strategy: retry

Validate before calling

// confirm the volume still exists right before Info
stubs, _, err := client.CSIVolumes().List(&api.QueryOptions{Prefix: volID})
if err != nil || len(stubs) == 0 { return fmt.Errorf("volume %s no longer exists", volID) }

Try / catch

var vol *api.CSIVolume
for i := 0; i < 3; i++ {
	v, _, err := client.CSIVolumes().Info(id, nil)
	if err == nil { vol = v; break }
	if strings.Contains(err.Error(), "404") { return fmt.Errorf("volume deregistered") }
	time.Sleep(time.Duration(1<<i) * 100 * time.Millisecond)
}

Prevention

When it happens

Trigger: `nomad volume status <exact-prefix>` where the follow-up Info call fails: the volume was deregistered after listing, the token lacks read capability for the volume's namespace, or the agent/server request errored.

Common situations: Stale CLI output — volume removed by another operator between commands; namespace mismatch between token and volume; transient server unavailability.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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