{"record":{"id":"a733bd8c10e75f67","repo":"mastra-ai/mastra","slug":"invalid-key","errorCode":"INVALID_KEY","errorMessage":"INVALID_KEY | LICENSE_EXPIRED | LICENSE_REVOKED | RATE_LIMITED","messagePattern":"INVALID_KEY \\| LICENSE_EXPIRED \\| LICENSE_REVOKED \\| RATE_LIMITED","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/license/index.ts","lineNumber":15,"sourceCode":"import type { IMastraLogger } from '../logger';\n\nexport interface LicenseValidationSuccess {\n  valid: true;\n  /** Feature entitlements granted by the license (e.g. 'rbac', 'sso', 'fga') */\n  entitlements: string[];\n  /** Plan tier the license was issued for (e.g. 'teams', 'enterprise') */\n  planTier: string;\n  expiresAt: string | null;\n  leaseTtlSeconds: number;\n}\n\nexport interface LicenseValidationError {\n  valid: false;\n  code: 'INVALID_KEY' | 'LICENSE_EXPIRED' | 'LICENSE_REVOKED' | 'RATE_LIMITED';\n  reason: string;\n}\n\nexport type LicenseValidationResponse = LicenseValidationSuccess | LicenseValidationError;\n\nexport type LicenseMode = 'enterprise' | 'open-source';\n\nexport type LicenseStatus = 'pending' | 'valid' | 'invalid';\n\nexport interface LicenseSnapshot {\n  mode: LicenseMode;\n  status: LicenseStatus;\n  entitlements: string[] | null;\n  planTier: string | null;\n  expiresAt: string | null;\n}\n\nexport class LicenseClient {","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/license/index.ts#L1-L33","documentation":"This is the license validation error-code union returned by the Mastra license server in a LicenseValidationError body: INVALID_KEY (unknown/malformed key), LICENSE_EXPIRED, LICENSE_REVOKED, or RATE_LIMITED. When validation returns valid:false with one of these codes, the client marks the license invalid, logs 'License validation failed: <code> - <reason>', clears cached state, and enterprise features become unavailable.","triggerScenarios":"Validation response body has valid:false with code INVALID_KEY (typo/mistyped key, key deleted in dashboard, wrong env var), LICENSE_EXPIRED (past expiresAt), LICENSE_REVOKED (manually revoked), or RATE_LIMITED (too many validation requests — though RATE_LIMITED is treated as transient and thrown instead).","commonSituations":"Copy-pasting a license key with whitespace or quotes into an env var; trial license expired; key rotated/revoked after a plan change; CI sharing one key across many runners hitting RATE_LIMITED.","solutions":["Check the logged reason string and the specific code in the validation response","For INVALID_KEY: verify MASTRA_LICENSE_KEY env var — no typos, whitespace, or stale keys — and re-copy from the dashboard","For LICENSE_EXPIRED/LICENSE_REVOKED: renew or reissue the key in the Mastra dashboard, then update the env var and restart","For RATE_LIMITED: back off and retry; reduce validation frequency or number of clients sharing the key","If you intend to run open-source only, remove the license key so the process runs in open-source mode"],"exampleFix":"// before\nMASTRA_LICENSE_KEY=\"  sk-live-abc12 \"  // stale/wrong key\n// after\nMASTRA_LICENSE_KEY=\"sk-live-valid-key-from-dashboard\"  # exact, current key","handlingStrategy":"validation","validationCode":"const key = process.env.MASTRA_LICENSE_KEY?.trim();\nif (!key || key.length < 8) {\n  throw new Error('MASTRA_LICENSE_KEY is missing or malformed');\n}","typeGuard":null,"tryCatchPattern":"const result = await validateLicense(key); // LicenseValidationResponse\nif (!result.valid) {\n  switch (result.code) {\n    case 'INVALID_KEY':      /* re-copy key from dashboard */ break;\n    case 'LICENSE_EXPIRED':  /* renew */ break;\n    case 'LICENSE_REVOKED':  /* reissue */ break;\n    case 'RATE_LIMITED':     /* back off and retry */ break;\n  }\n}","preventionTips":["Store the key in a secret manager; copy exactly with no whitespace or quotes","Set expiry reminders for license renewal dates","Watch startup logs for 'License validation failed: <code> - <reason>'","Reduce number of processes sharing one key to avoid RATE_LIMITED","Drop the key env var intentionally if you want open-source mode"],"tags":["license","validation","configuration","entitlement"],"backgroundTag":"license-validation-failed","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}