hashicorp/nomad · error

Error querying CSI volumes: %w

Error message

Error querying CSI volumes: %w

What it means

csiVolumesList (used by plain `nomad volume status` and by csiVolumeStatus's fallback listing section) calls client.CSIVolumes().List(nil). Failures from this list call — ACL denial, network errors, server 5xx — are wrapped as `Error querying CSI volumes`. An empty list is explicitly not an error (prints 'No CSI volumes').

Source

Thrown at command/volume_status_csi.go:64

	}

	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 {
		return fmt.Errorf("Error querying CSI volumes: %w", err)
	}

	if len(vols) == 0 {
		c.Ui.Error("No CSI volumes")
		return nil // not an empty is not an error
	} else {
		str, err := csiFormatVolumes(vols, opts.json, opts.template)
		if err != nil {
			return fmt.Errorf("Error formatting: %w", err)
		}
		c.Ui.Output(str)
	}
	if !opts.verbose {
		return nil
	}

	plugins, _, err := client.CSIPlugins().List(nil)
	if err != nil {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check the wrapped cause and fix transport: verify NOMAD_ADDR and agent reachability.
  2. Provide a token with volume list capability: export NOMAD_TOKEN or `nomad login`.
  3. Check server logs / `nomad server members` and retry after cluster recovery.
Defensive patterns

Strategy: try-catch

Validate before calling

if os.Getenv("NOMAD_ADDR") == "" { return fmt.Errorf("NOMAD_ADDR not set") }
if _, err := client.Agent().Health(); err != nil {
	return fmt.Errorf("nomad agent not reachable: %v", err)
}

Try / catch

vols, _, err := client.CSIVolumes().List(nil)
if err != nil {
	var apiErr *api.APIError
	if errors.As(err, &apiErr) && apiErr.ErrCode() == 403 {
		return fmt.Errorf("insufficient ACL capabilities for volume list")
	}
	return fmt.Errorf("Error querying CSI volumes: %w", err)
}

Prevention

When it happens

Trigger: `nomad volume status` (no args, CSI section) when CSIVolumes().List fails: unreachable agent, token without volume list capability, server error.

Common situations: No ACL token configured (NOMAD_TOKEN unset) against an ACL-enabled cluster; network/DNS issues to NOMAD_ADDR; CSI plugin/controller outages surfacing as list errors.

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/c27c15d09b21ca78. Report an issue: GitHub.