hashicorp/nomad · error

Quota %q matched no quotas

Error message

Quota %q matched no quotas

What it means

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.

Source

Thrown at command/quota_status.go:363

			memMaxField := fmt.Sprintf("%d / %s", memMaxUsed, formatQuotaLimitInt(np.MemoryMaxMB))

			nodePoolLimits = append(nodePoolLimits, fmt.Sprintf("%s|%s|%s|%s|%s|%s", specLimit.Region, np.NodePool, cpuField, coresField, memField, memMaxField))
		}
	}

	return formatList(nodePoolLimits)
}

func getQuotaByPrefix(client *api.Quotas, quota string) (match *api.QuotaSpec, possible []*api.QuotaSpec, err error) {
	// Do a prefix lookup
	quotas, _, err := client.PrefixList(quota, nil)
	if err != nil {
		return nil, nil, err
	}

	switch len(quotas) {
	case 0:
		return nil, nil, fmt.Errorf("Quota %q matched no quotas", quota)
	case 1:
		return quotas[0], nil, nil
	default:
		// find exact match if possible
		for _, q := range quotas {
			if q.Name == quota {
				return q, nil, nil
			}
		}
		return nil, quotas, nil
	}
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Run `nomad quota list` to see available quotas and copy the exact name.
  2. Check NOMAD_ADDR/NAMESPACE and ACL token point at the intended cluster with quota read capabilities.
  3. Verify exact spelling and case; the lookup is prefix-based but requires at least one match.
  4. Recreate the quota with `nomad quota apply` if it was deleted.

Example fix

// before
nomad quota status prod-quotta
// after
nomad quota list
nomad quota status prod-quota
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check the quota exists before prefix-dependent commands
quotas, _, err := client.Quotas().List(nil)
if err != nil {
    return err
}
found := false
for _, q := range quotas {
    if q.Name == wanted {
        found = true
        break
    }
}
if !found {
    return fmt.Errorf("quota %q not found; run 'nomad quota list'", wanted)
}

Try / catch

// Handle both not-found and ambiguous-prefix errors
name, _, err := getQuotaByPrefix(client, quotaID)
if err != nil {
    var mr *multierror.Error
    if strings.Contains(err.Error(), "matched no quotas") {
        // suggest: nomad quota list
        return fmt.Errorf("quota %q does not exist; run 'nomad quota list'", quotaID)
    }
    if errors.As(err, &mr) {
        // multiple matches: ask user to disambiguate
    }
    return err
}

Prevention

When it happens

Trigger: 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).

Common situations: 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).

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/1cf1400beeba0ba0. Report an issue: GitHub.