{"record":{"id":"462d4e913e755db5","repo":"Budibase/budibase","slug":"error-getting-license-message","errorCode":null,"errorMessage":"Error getting license: ${message}","messagePattern":"Error getting license: (.+?)","errorType":"http","errorClass":"HTTPError","httpStatus":null,"severity":"critical","filePath":"packages/pro/src/sdk/licensing/licenses/client.ts","lineNumber":133,"sourceCode":"            tenantId: installTenantId,\n            version: installVersion,\n          },\n        }\n\n        try {\n          const response = await api.post(`/api/license`, {\n            headers: { ...authHeader },\n            body,\n          })\n\n          if (response.status === 404 || response.status === 403) {\n            // no license for the tenant\n            return\n          }\n\n          if (response.status !== 200) {\n            const message = await getResponseErrorMessage(response)\n            throw new HTTPError(\n              `Error getting license: ${message}`,\n              response.status\n            )\n          }\n\n          return response.json()\n        } catch (err) {\n          // account portal isn't present - no license found\n          if (env.DISABLE_ACCOUNT_PORTAL) {\n            return\n          }\n          throw err\n        }\n      }\n    )\n  })\n}\n","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/pro/src/sdk/licensing/licenses/client.ts#L115-L151","documentation":"When the licensing client fetches a tenant license from the licensing service, any non-200 response is converted into an HTTPError whose message embeds the upstream error text retrieved by getResponseErrorMessage, plus the upstream status code. A 404 (or a missing license response that isn't handled earlier) means the tenant has no license; 401/403 mean auth problems; 5xx mean the licensing service failed.","triggerScenarios":"Calling _getLicense (via the client's get license path) when the licensing API responds with a non-200 status: unlicensed tenant (404), invalid/expired license key or credentials (401/403), or a licensing service outage (5xx).","commonSituations":"Self-hosted Budibase where SELF_HOSTED_LICENSE_KEY is unset or invalid; the licensing account service is unreachable/degraded; tenant id mismatch so the license lookup 404s; network/proxy issues causing gateway errors.","solutions":["Check the embedded status code: if 404, confirm the tenant actually has a license and the license key is correctly configured.","If 401/403, fix the license key / API credentials used to authenticate with the licensing service.","If 5xx or network errors, retry with backoff and check the licensing service status; wrap the call in retry logic.","Refresh the cached license after fixing credentials so subsequent feature checks succeed."],"exampleFix":"// before\nconst license = await licenses.getCachedLicense() // throws HTTPError\n// after\nlet license\ntry {\n  license = await licenses.getCachedLicense()\n} catch (err) {\n  if (err instanceof HTTPError && err.status === 404) {\n    license = null // no license for tenant — handle gracefully\n  } else {\n    throw err\n  }\n}","handlingStrategy":"retry","validationCode":"const hasKey = !!env.SELF_HOSTED_LICENSE_KEY || !!licenseConfig\nif (!hasKey) { /* skip license fetch; run in unlicensed mode */ }","typeGuard":"function isLicenseHttpError(err: unknown): err is HTTPError {\n  return err instanceof HTTPError && typeof err.status === \"number\"\n}","tryCatchPattern":"try {\n  license = await getLicense()\n} catch (err) {\n  if (err instanceof HTTPError) {\n    if (err.status === 404) { /* no license — degrade */ }\n    else if (err.status >= 500 || err.status === 429) { /* retry with backoff */ }\n    else { /* fix credentials/license key */ }\n  } else throw err\n}","preventionTips":["Verify the license key env/config before startup and log its presence (not value)","Implement retry with exponential backoff for 5xx/429 from the licensing service","Handle 404 explicitly as 'unlicensed tenant' rather than a hard failure","Monitor the licensing service and fall back to cached license when available"],"tags":["network","licensing","http","license-key"],"backgroundTag":"license-fetch-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}