hashicorp/nomad · info

Nomad Enterprise only endpoint

Error message

Nomad Enterprise only endpoint

What it means

This error is returned by LicenseGet in the Nomad HTTP API client when the server responds with HTTP 204 No Content. The license endpoint only exists in Nomad Enterprise; an OSS Nomad server answers with 204 to signal there is no license payload. The client converts that status into this explicit error instead of returning an empty license.

Source

Thrown at api/operator.go:399

	return wm, nil
}

func (op *Operator) LicenseGet(q *QueryOptions) (*LicenseReply, *QueryMeta, error) {
	req, err := op.c.newRequest("GET", "/v1/operator/license")
	if err != nil {
		return nil, nil, err
	}
	req.setQueryOptions(q)

	var reply LicenseReply
	rtt, resp, err := op.c.doRequest(req) //nolint:bodyclose
	if err != nil {
		return nil, nil, err
	}
	defer resp.Body.Close()

	if resp.StatusCode == http.StatusNoContent {
		return nil, nil, errors.New("Nomad Enterprise only endpoint")
	}

	if resp.StatusCode != http.StatusOK {
		return nil, nil, newUnexpectedResponseError(
			fromHTTPResponse(resp),
			withExpectedStatuses([]int{http.StatusOK, http.StatusNoContent}),
		)
	}

	err = json.NewDecoder(resp.Body).Decode(&reply)
	if err != nil {
		return nil, nil, err
	}

	qm := &QueryMeta{}
	parseQueryMeta(resp, qm)
	qm.RequestTime = rtt

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Only call LicenseGet against Nomad Enterprise agents (check build via Agent().Specialization or /v1/agent/self 'Build.Enterprise').
  2. Treat a 204/this error as 'no license' rather than a failure and skip license logic for OSS clusters.
  3. Check the error message for 'Nomad Enterprise only endpoint' and branch accordingly.
  4. Upgrade to Nomad Enterprise if you actually need license visibility.

Example fix

// before
lic, _, err := operator.LicenseGet(nil)
if err != nil { return err }
// after
lic, _, err := operator.LicenseGet(nil)
if err != nil {
    if strings.Contains(err.Error(), "Nomad Enterprise only endpoint") {
        return nil // OSS cluster: no license to fetch
    }
    return err
}
Defensive patterns

Strategy: try-catch

Validate before calling

var spec string
agentSelf, _, _ := client.Agent().Self()
if m, ok := agentSelf.Config["Enterprise"]; ok { spec, _ = m.(string) }
canQueryLicense := spec != "" // non-empty on Enterprise builds

Type guard

func isEnterpriseOnlyEndpointErr(err error) bool {
    return err != nil && strings.Contains(err.Error(), "Nomad Enterprise only endpoint")
}

Try / catch

lic, _, err := operator.LicenseGet(nil)
if err != nil {
    if isEnterpriseOnlyEndpointErr(err) {
        return nil // OSS cluster, skip license handling
    }
    return err
}

Prevention

When it happens

Trigger: Calling client.Operator().LicenseGet(q) against a Nomad OSS (open-source) agent, or any agent older/newer than the endpoint, which replies 204 instead of 200 with a license body.

Common situations: Scripts or dashboards that inspect cluster licensing run against a community-edition Nomad cluster; automated license-expiry checks deployed fleet-wide hit OSS agents; upgrading/downgrading between OSS and Enterprise builds.

Related errors


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