{"record":{"id":"aefefe917ce03b27","repo":"hashicorp/nomad","slug":"nomad-enterprise-only-endpoint","errorCode":null,"errorMessage":"Nomad Enterprise only endpoint","messagePattern":"Nomad Enterprise only endpoint","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"api/operator.go","lineNumber":399,"sourceCode":"\treturn wm, nil\n}\n\nfunc (op *Operator) LicenseGet(q *QueryOptions) (*LicenseReply, *QueryMeta, error) {\n\treq, err := op.c.newRequest(\"GET\", \"/v1/operator/license\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.setQueryOptions(q)\n\n\tvar reply LicenseReply\n\trtt, resp, err := op.c.doRequest(req) //nolint:bodyclose\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == http.StatusNoContent {\n\t\treturn nil, nil, errors.New(\"Nomad Enterprise only endpoint\")\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, nil, newUnexpectedResponseError(\n\t\t\tfromHTTPResponse(resp),\n\t\t\twithExpectedStatuses([]int{http.StatusOK, http.StatusNoContent}),\n\t\t)\n\t}\n\n\terr = json.NewDecoder(resp.Body).Decode(&reply)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tqm := &QueryMeta{}\n\tparseQueryMeta(resp, qm)\n\tqm.RequestTime = rtt\n","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/operator.go#L381-L417","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Only call LicenseGet against Nomad Enterprise agents (check build via Agent().Specialization or /v1/agent/self 'Build.Enterprise').","Treat a 204/this error as 'no license' rather than a failure and skip license logic for OSS clusters.","Check the error message for 'Nomad Enterprise only endpoint' and branch accordingly.","Upgrade to Nomad Enterprise if you actually need license visibility."],"exampleFix":"// before\nlic, _, err := operator.LicenseGet(nil)\nif err != nil { return err }\n// after\nlic, _, err := operator.LicenseGet(nil)\nif err != nil {\n    if strings.Contains(err.Error(), \"Nomad Enterprise only endpoint\") {\n        return nil // OSS cluster: no license to fetch\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"var spec string\nagentSelf, _, _ := client.Agent().Self()\nif m, ok := agentSelf.Config[\"Enterprise\"]; ok { spec, _ = m.(string) }\ncanQueryLicense := spec != \"\" // non-empty on Enterprise builds","typeGuard":"func isEnterpriseOnlyEndpointErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"Nomad Enterprise only endpoint\")\n}","tryCatchPattern":"lic, _, err := operator.LicenseGet(nil)\nif err != nil {\n    if isEnterpriseOnlyEndpointErr(err) {\n        return nil // OSS cluster, skip license handling\n    }\n    return err\n}","preventionTips":["Gate LicenseGet calls behind an Enterprise build check from /v1/agent/self.","Treat 204/Nomad-Enterprise-only errors as 'no license' in monitoring code.","Avoid blanket license checks in fleet-wide tooling that also manages OSS clusters."],"tags":["http","licensing","nomad-enterprise","api"],"backgroundTag":"enterprise-only-endpoint","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"}