{"record":{"id":"dabb99ef2c0923e4","repo":"hashicorp/nomad","slug":"error-querying-csi-plugins-w","errorCode":null,"errorMessage":"Error querying CSI plugins: %w","messagePattern":"Error querying CSI plugins: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/volume_status_csi.go","lineNumber":83,"sourceCode":"\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 {\n\t\treturn fmt.Errorf(\"Error querying CSI plugins: %w\", err)\n\t}\n\n\tif len(plugins) == 0 {\n\t\treturn nil // No more output if we have no plugins\n\t}\n\n\tvar mErr *multierror.Error\n\tq := &api.QueryOptions{PerPage: 30} // TODO: tune page size\n\nNEXT_PLUGIN:\n\tfor _, plugin := range plugins {\n\t\tif !plugin.ControllerRequired || plugin.ControllersHealthy < 1 {\n\t\t\tcontinue // only controller plugins can support this query\n\t\t}\n\t\tfor {\n\t\t\texternalList, _, err := client.CSIVolumes().ListExternal(plugin.ID, q)\n\t\t\tif err != nil && !errors.Is(err, io.EOF) {\n\t\t\t\tmErr = multierror.Append(mErr, fmt.Errorf(","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/volume_status_csi.go#L65-L101","documentation":"csiVolumesList wraps errors from client.CSIPlugins().List(nil) when the -verbose path queries the plugin list after printing volumes. It indicates the Nomad API call to enumerate CSI plugins failed; the HTTP/API error is wrapped via %w.","triggerScenarios":"Run or csiVolumeStatus invokes csiVolumesList with opts.verbose true, and the CSIPlugins().List API call fails — typically ACL token lacking plugin list capability, unreachable agent, or connection error.","commonSituations":"Running with an expired or too-restrictive NOMAD_TOKEN (missing plugin:read / list ACL), pointing NOMAD_ADDR at a dead server, or network partition between CLI and Nomad agent.","solutions":["Read the wrapped error: if 403, use a token with plugin list permissions (management or plugin:read)","Verify NOMAD_ADDR/agent reachability with nomad server members or nomad status","Retry after confirming cluster connectivity; the call is a plain list with no pagination loop"],"exampleFix":"// before\nNOMAD_TOKEN=<read-only-token> nomad volume status -verbose\n// after\nNOMAD_TOKEN=<management-or-plugin-read-token> nomad volume status -verbose","handlingStrategy":"try-catch","validationCode":"// preflight: check ACL + connectivity before verbose listing\n_, err := client.CSIPlugins().List(nil)\nif err != nil { /* abort early with clear message */ }","typeGuard":null,"tryCatchPattern":"err := cmd.Run()\nif err != nil {\n    if strings.Contains(err.Error(), \"Error querying CSI plugins\") {\n        // check NOMAD_TOKEN permissions and NOMAD_ADDR reachability\n    }\n}","preventionTips":["Use a token with plugin:read/list ACLs for -verbose","Verify NOMAD_ADDR with a cheap call (nomad status) first","Don't pass -verbose unless plugin data is needed"],"tags":["cli","api","acl","csi"],"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"}