{"record":{"id":"1cf1400beeba0ba0","repo":"hashicorp/nomad","slug":"quota-q-matched-no-quotas","errorCode":null,"errorMessage":"Quota %q matched no quotas","messagePattern":"Quota %q matched no quotas","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/quota_status.go","lineNumber":363,"sourceCode":"\t\t\tmemMaxField := fmt.Sprintf(\"%d / %s\", memMaxUsed, formatQuotaLimitInt(np.MemoryMaxMB))\n\n\t\t\tnodePoolLimits = append(nodePoolLimits, fmt.Sprintf(\"%s|%s|%s|%s|%s|%s\", specLimit.Region, np.NodePool, cpuField, coresField, memField, memMaxField))\n\t\t}\n\t}\n\n\treturn formatList(nodePoolLimits)\n}\n\nfunc getQuotaByPrefix(client *api.Quotas, quota string) (match *api.QuotaSpec, possible []*api.QuotaSpec, err error) {\n\t// Do a prefix lookup\n\tquotas, _, err := client.PrefixList(quota, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tswitch len(quotas) {\n\tcase 0:\n\t\treturn nil, nil, fmt.Errorf(\"Quota %q matched no quotas\", quota)\n\tcase 1:\n\t\treturn quotas[0], nil, nil\n\tdefault:\n\t\t// find exact match if possible\n\t\tfor _, q := range quotas {\n\t\t\tif q.Name == quota {\n\t\t\t\treturn q, nil, nil\n\t\t\t}\n\t\t}\n\t\treturn nil, quotas, nil\n\t}\n}\n","sourceCodeStart":345,"sourceCodeEnd":376,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/quota_status.go#L345-L376","documentation":"getQuotaByPrefix resolves a user-supplied quota name/prefix via the Nomad API's quota list-with-prefix endpoint. If the prefix matches zero quotas, the command fails with `Quota %q matched no quotas`. This protects users from applying/statusing against a nonexistent quota, since Nomad supports prefix-based lookup for convenience.","triggerScenarios":"Running `nomad quota status <name>` or similar with a name that doesn't exist on the cluster (typo, wrong region/namespace permissions filtering it out, or the quota was deleted).","commonSituations":"Typo in the quota name; running against the wrong cluster (dev vs prod via NOMAD_ADDR); quota deleted by a teammate; insufficient ACL capabilities hiding the quota from list results; case-sensitivity mismatch (quota names are case-sensitive).","solutions":["Run `nomad quota list` to see available quotas and copy the exact name.","Check NOMAD_ADDR/NAMESPACE and ACL token point at the intended cluster with quota read capabilities.","Verify exact spelling and case; the lookup is prefix-based but requires at least one match.","Recreate the quota with `nomad quota apply` if it was deleted."],"exampleFix":"// before\nnomad quota status prod-quotta\n// after\nnomad quota list\nnomad quota status prod-quota","handlingStrategy":"validation","validationCode":"// Pre-check the quota exists before prefix-dependent commands\nquotas, _, err := client.Quotas().List(nil)\nif err != nil {\n    return err\n}\nfound := false\nfor _, q := range quotas {\n    if q.Name == wanted {\n        found = true\n        break\n    }\n}\nif !found {\n    return fmt.Errorf(\"quota %q not found; run 'nomad quota list'\", wanted)\n}","typeGuard":null,"tryCatchPattern":"// Handle both not-found and ambiguous-prefix errors\nname, _, err := getQuotaByPrefix(client, quotaID)\nif err != nil {\n    var mr *multierror.Error\n    if strings.Contains(err.Error(), \"matched no quotas\") {\n        // suggest: nomad quota list\n        return fmt.Errorf(\"quota %q does not exist; run 'nomad quota list'\", quotaID)\n    }\n    if errors.As(err, &mr) {\n        // multiple matches: ask user to disambiguate\n    }\n    return err\n}","preventionTips":["Run `nomad quota list` and copy exact names; names are case-sensitive","Confirm NOMAD_ADDR/ACL token target the intended cluster with quota:read","Use full quota names in scripts instead of prefixes","Check quota existence after deletions before dependent commands"],"tags":["nomad","cli","quota","prefix-lookup"],"backgroundTag":"resource-not-found","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"}