{"record":{"id":"c27c15d09b21ca78","repo":"hashicorp/nomad","slug":"error-querying-csi-volumes-w","errorCode":null,"errorMessage":"Error querying CSI volumes: %w","messagePattern":"Error querying CSI volumes: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/volume_status_csi.go","lineNumber":64,"sourceCode":"\t}\n\n\tstr, err := c.formatCSIBasic(vol)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error formatting CSI volume: %w\", err)\n\t}\n\tc.Ui.Output(str)\n\treturn nil\n}\n\nfunc (c *VolumeStatusCommand) csiVolumesList(client *api.Client, opts formatOpts) error {\n\n\tif !(opts.json || len(opts.template) > 0) {\n\t\tc.Ui.Output(c.Colorize().Color(\"[bold]Container Storage Interface[reset]\"))\n\t}\n\n\tvols, _, err := client.CSIVolumes().List(nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying CSI volumes: %w\", err)\n\t}\n\n\tif len(vols) == 0 {\n\t\tc.Ui.Error(\"No CSI volumes\")\n\t\treturn nil // not an empty is not an error\n\t} else {\n\t\tstr, err := csiFormatVolumes(vols, opts.json, opts.template)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error formatting: %w\", err)\n\t\t}\n\t\tc.Ui.Output(str)\n\t}\n\tif !opts.verbose {\n\t\treturn nil\n\t}\n\n\tplugins, _, err := client.CSIPlugins().List(nil)\n\tif err != nil {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/volume_status_csi.go#L46-L82","documentation":"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').","triggerScenarios":"`nomad volume status` (no args, CSI section) when CSIVolumes().List fails: unreachable agent, token without volume list capability, server error.","commonSituations":"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.","solutions":["Check the wrapped cause and fix transport: verify NOMAD_ADDR and agent reachability.","Provide a token with volume list capability: export NOMAD_TOKEN or `nomad login`.","Check server logs / `nomad server members` and retry after cluster recovery."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if os.Getenv(\"NOMAD_ADDR\") == \"\" { return fmt.Errorf(\"NOMAD_ADDR not set\") }\nif _, err := client.Agent().Health(); err != nil {\n\treturn fmt.Errorf(\"nomad agent not reachable: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"vols, _, err := client.CSIVolumes().List(nil)\nif err != nil {\n\tvar apiErr *api.APIError\n\tif errors.As(err, &apiErr) && apiErr.ErrCode() == 403 {\n\t\treturn fmt.Errorf(\"insufficient ACL capabilities for volume list\")\n\t}\n\treturn fmt.Errorf(\"Error querying CSI volumes: %w\", err)\n}","preventionTips":["Set NOMAD_TOKEN with volume:list capabilities for target namespaces.","Health-check the agent before batch volume operations.","Distinguish empty results ('No CSI volumes') from actual API errors."],"tags":["nomad-api","csi","acl","network"],"backgroundTag":"api-request-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}