{"record":{"id":"98921d47fc7d69c3","repo":"hashicorp/nomad","slug":"prefix-matched-multiple-csi-volumes-s","errorCode":null,"errorMessage":"Prefix matched multiple CSI volumes\n\n%s","messagePattern":"Prefix matched multiple CSI volumes\n\n(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"command/volume_status_csi.go","lineNumber":39,"sourceCode":"\t}\n\n\t// get a CSI volume that matches the given prefix or a list of all matches if an\n\t// exact match is not found.\n\tvolStub, possible, err := getByPrefix[api.CSIVolumeListStub](\"volumes\", client.CSIVolumes().List,\n\t\tfunc(vol *api.CSIVolumeListStub, prefix string) bool { return vol.ID == prefix },\n\t\t&api.QueryOptions{\n\t\t\tPrefix:    id,\n\t\t\tNamespace: c.namespace,\n\t\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error listing CSI volumes: %w\", err)\n\t}\n\tif len(possible) > 0 {\n\t\tout, err := csiFormatVolumes(possible, c.json, c.template)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error formatting: %w\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"Prefix matched multiple CSI volumes\\n\\n%s\", out)\n\t}\n\n\t// Try querying the volume\n\tvol, _, err := client.CSIVolumes().Info(volStub.ID, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying CSI volume: %w\", err)\n\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","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/volume_status_csi.go#L21-L57","documentation":"If the prefix given to `nomad volume status` matches multiple CSI volumes, the command does not pick one; instead it renders the matching list and returns `Prefix matched multiple CSI volumes\\n\\n<table>` as an error to show the user the candidates. It is a deliberate disambiguation prompt, not an internal failure.","triggerScenarios":"`nomad volume status <short-prefix>` where List with that Prefix returns 2+ CSIVolumeListStub entries.","commonSituations":"Short human-friendly volume names sharing a prefix (e.g. 'web-cache', 'web-data'); copy-pasting only part of a UUID.","solutions":["Re-run with a longer prefix or the full volume ID so exactly one volume matches.","Pick the exact ID from the table the command prints below the message.","Use `nomad volume status` with no argument to browse all volumes and find the exact ID."],"exampleFix":"// before\nnomad volume status web\n// after\nnomad volume status web-data","handlingStrategy":"validation","validationCode":"// resolve to exactly one volume before status\nmatches, _, err := client.CSIVolumes().List(&api.QueryOptions{Prefix: prefix})\nif err != nil { return err }\nif len(matches) != 1 {\n\tids := make([]string, len(matches))\n\tfor i, m := range matches { ids[i] = m.ID }\n\treturn fmt.Errorf(\"prefix %q matched %d volumes: %v\", prefix, len(matches), ids)\n}","typeGuard":null,"tryCatchPattern":"err := cmd.Run()\nif err != nil && strings.Contains(err.Error(), \"Prefix matched multiple CSI volumes\") {\n\t// parse the printed table and rerun with a longer prefix\n}","preventionTips":["Copy full UUIDs, not truncated prefixes.","Name volumes with distinctive prefixes.","In scripts, list first and select an exact ID programmatically."],"tags":["nomad-cli","csi","prefix-match","ux"],"backgroundTag":"ambiguous-prefix-match","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"}