Budibase/budibase · error · HTTPError
Invalid license key
Error message
Invalid license key
What it means
Thrown by activateLicenseKey when POST /api/license/activate responds with 403, meaning the account portal rejected the license key as invalid. The library deliberately converts the 403 to a 400 so the caller is not logged out by generic 403 handling. It signals the key itself is not recognized/entitled, not a transport or server failure.
Source
Thrown at packages/pro/src/sdk/licensing/licenses/client.ts:239
licenseKey: string
): Promise<License | undefined> => {
const install = await installation.getInstall()
const body: LicenseActivateRequest = {
installVersion: install.version,
installId: install.installId,
}
const response = await api.post(`/api/license/activate`, {
headers: {
[constants.Header.LICENSE_KEY]: licenseKey,
},
body,
})
// don't propagate the 403 to prevent logout
if (response.status === 403) {
throw new HTTPError("Invalid license key", 400)
}
if (response.status === 409) {
throw new HTTPError("License key has already been activated", 409)
}
if (response.status !== 200) {
const message = await getResponseErrorMessage(response)
throw new HTTPError(
`Error activating license key: ${message}`,
response.status
)
}
return response.json()
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Double-check the license key for typos/truncation and re-enter it exactly as issued.
- Confirm the key belongs to this installation type/environment and the account portal URL (INTERNAL_ACCOUNT_PORTAL_URL / ACCOUNT_PORTAL_URL) matches where the key was issued.
- Verify the license is still active (not cancelled/expired) in the account portal.
- If the key is valid but still rejected, contact Budibase support with the key and install details.
Example fix
// before
await activateLicenseKey(userInput.trim())
// after
if (!userInput || userInput.trim().length === 0) {
throw new Error("License key is required")
}
await activateLicenseKey(userInput.trim()) Defensive patterns
Strategy: validation
Validate before calling
function isValidKeyFormat(key: string): boolean {
return typeof key === "string" && key.trim().length > 0 && /^[A-Za-z0-9-_]+$/.test(key.trim())
}
if (!isValidKeyFormat(userKey)) throw new Error("License key format looks invalid") Type guard
function isHTTPError(e: unknown): e is HTTPError {
return e instanceof HTTPError
} Try / catch
try {
await activateLicenseKey(key)
} catch (e) {
if (isHTTPError(e) && e.status === 400) {
// show 'license key invalid — check key and environment' to the user
} else throw e
} Prevention
- Trim and normalize license keys before activation.
- Use a dedicated license key per environment; never share keys between installs.
- Verify the portal URL env vars point at the same portal that issued the key.
- Confirm the license is active in the account portal before activation attempts.
When it happens
Trigger: Calling activateLicenseKey(licenseKey) with a key the account portal does not recognize, a key that was revoked, or a key from a different environment — the portal returns 403 for the activation request.
Common situations: Typo'd or truncated license key pasted into self-host activation UI; key for a cloud tenant used on a self-host install; license cancelled on the account portal; pointing the install at the wrong account portal URL so the key is unknown there.
Related errors
- License key has already been activated
- Error activating license key: ${message}
- Audit logs not available - license required.
- User does not have access to environment variables feature.
- FEATURE_DISABLED
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/a9be18e547ef605d.
Report an issue: GitHub.