{"record":{"id":"9c6cffc93d24682c","repo":"hashicorp/nomad","slug":"no-volumes-with-prefix-or-id-q-found","errorCode":null,"errorMessage":"no volumes with prefix or ID %q found","messagePattern":"no volumes with prefix or ID %q found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/volume_status_host.go","lineNumber":93,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"Error formatting host volumes: %w\", err)\n\t}\n\tc.Ui.Output(c.Colorize().Color(str))\n\treturn nil\n}\n\nfunc getHostVolumeByPrefix(client *api.Client, prefix, ns string) (*api.HostVolumeStub, []*api.HostVolumeStub, error) {\n\tvols, _, err := client.HostVolumes().List(nil, &api.QueryOptions{\n\t\tPrefix:    prefix,\n\t\tNamespace: ns,\n\t})\n\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error querying volumes: %w\", err)\n\t}\n\tswitch len(vols) {\n\tcase 0:\n\t\treturn nil, nil, fmt.Errorf(\"no volumes with prefix or ID %q found\", prefix)\n\tcase 1:\n\t\treturn vols[0], nil, nil\n\tdefault:\n\t\t// search for exact matches to account for multiple exact ID or name\n\t\t// matches across namespaces\n\t\tvar match *api.HostVolumeStub\n\t\texactMatchesCount := 0\n\t\tfor _, vol := range vols {\n\t\t\tif vol.ID == prefix || vol.Name == prefix {\n\t\t\t\texactMatchesCount++\n\t\t\t\tmatch = vol\n\t\t\t}\n\t\t}\n\t\tif exactMatchesCount == 1 {\n\t\t\treturn match, nil, nil\n\t\t}\n\t\treturn nil, vols, nil\n\t}","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/volume_status_host.go#L75-L111","documentation":"Returned by getHostVolumeByPrefix when the prefix/ID query matched zero host volumes in the namespace — the requested volume does not exist (or is in another namespace).","triggerScenarios":"Thrown at command/volume_status_host.go:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the volume ID/prefix spelling and namespace","Run nomad volume status (list) to see existing volumes","Create the volume if it does not yet exist"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}