{"record":{"id":"a0690e5a86242e7c","repo":"remotion-dev/remotion","slug":"json-error","errorCode":null,"errorMessage":"{json.error}","messagePattern":"\\{json\\.error\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/licensing/src/get-usage.ts","lineNumber":60,"sourceCode":"\t\tbody: JSON.stringify({\n\t\t\tapiKey: licenseKey ?? apiKey,\n\t\t\tsince: since ?? null,\n\t\t}),\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t});\n\tconst json = (await res.json()) as GetUsageApiResponse;\n\n\tif (json.success) {\n\t\treturn {\n\t\t\tcloudRenders: json.cloudRenders,\n\t\t\twebRenders: json.webcodecConversions,\n\t\t\twebcodecConversions: json.webcodecConversions,\n\t\t};\n\t}\n\n\tthrow new Error(json.error);\n};\n","sourceCodeStart":42,"sourceCodeEnd":62,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/licensing/src/get-usage.ts#L42-L62","documentation":"getUsage() POSTs to the Remotion licensing server (remotion.pro) and expects a JSON body with success:true. If the server returns success:false it surfaces the server's error string verbatim. Typical server errors are invalid/expired license key, malformed request, or rate limiting.","triggerScenarios":"Calling getUsage() with a wrong/expired license key; passing apiKey instead of licenseKey on v5 (or vice versa on v4); network proxies mangling the response; the licensing backend returning a temporary error.","commonSituations":"Renewed but not re-installed license keys; copy-paste errors in the license key; pointing to the wrong account; license revoked.","solutions":["Read json.error verbatim — the server message states the precise problem (invalid key, quota, etc.).","Verify the license key in the Remotion license dashboard and re-paste it.","Use the correct credential field for your version (licenseKey on v5; apiKey or licenseKey on v4).","Retry after confirming the key, since some failures are transient backend issues."],"exampleFix":"// before\nconst usage = await getUsage({apiKey: 'old-or-typoed-key'});\n// after\nconst usage = await getUsage({licenseKey: process.env.REMOTION_LICENSE_KEY});","handlingStrategy":"try-catch","validationCode":"function looksLikeLicenseKey(k: string | null): boolean {\n  return typeof k === 'string' && k.length > 10 && /^[A-Za-z0-9_-]+$/.test(k);\n}\nif (!looksLikeLicenseKey(process.env.REMOTION_LICENSE_KEY ?? null)) {\n  console.warn('License key looks invalid; getUsage may fail.');\n}","typeGuard":"const isValidLicenseKey = (k: unknown): k is string =>\n  typeof k === 'string' && k.trim().length > 10;","tryCatchPattern":"try {\n  const usage = await getUsage({licenseKey});\n} catch (e) {\n  console.error('Licensing server error:', (e as Error).message);\n  // surface to user, do not block render\n}","preventionTips":["Store REMOTION_LICENSE_KEY in your environment, never in code.","Use the correct credential field for your Remotion major version.","Treat getUsage failures as non-fatal in your dashboards.","Rotate keys via the remotion.pro dashboard and update env promptly."],"tags":["typescript","licensing","network","license-key"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}