{"record":{"id":"87ecbf7bcda56221","repo":"heygen-com/hyperframes","slug":"freeze-failed-size-bytes-exceeds-max-freeze","errorCode":null,"errorMessage":"freeze failed: ${size} bytes exceeds ${MAX_FREEZE_BYTES} cap","messagePattern":"freeze failed: (.+?) bytes exceeds (.+?) cap","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/figma/freeze.ts","lineNumber":64,"sourceCode":"  const host = parsed.hostname;\n  return host === \"figma.com\" || host.endsWith(\".figma.com\") || host.endsWith(\".amazonaws.com\");\n}\n\nexport async function freezeUrl(url: string, destPath: string): Promise<number> {\n  if (!isAllowedFreezeUrl(url))\n    throw new Error(`freeze failed: refusing non-figma url ${url} (https + figma hosts only)`);\n  const res = await fetch(url);\n  if (!res.ok) throw new Error(`freeze failed: HTTP ${res.status}`);\n  const declared = Number(res.headers.get(\"content-length\") ?? 0);\n  if (exceedsFreezeCap(declared))\n    throw new Error(`freeze failed: content-length ${declared} exceeds ${MAX_FREEZE_BYTES} cap`);\n  return freezeBytes(new Uint8Array(await res.arrayBuffer()), destPath);\n}\n\nexport function freezeLocalFile(srcPath: string, destPath: string): void {\n  const size = statSync(srcPath).size;\n  if (exceedsFreezeCap(size))\n    throw new Error(`freeze failed: ${size} bytes exceeds ${MAX_FREEZE_BYTES} cap`);\n  mkdirSync(dirname(destPath), { recursive: true });\n  copyFileSync(srcPath, destPath);\n}\n","sourceCodeStart":46,"sourceCodeEnd":68,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/core/src/figma/freeze.ts#L46-L68","documentation":"Thrown by freezeLocalFile when statSync(srcPath).size exceeds MAX_FREEZE_BYTES (256 MiB). freezeLocalFile copies a file already on disk into the freeze destination; the size check guards the same disk-fill risk as freezeBytes/freezeUrl but reads the actual filesystem size via statSync rather than a buffer length or HTTP header. The copy (copyFileSync) never runs if the cap is exceeded.","triggerScenarios":"Calling freezeLocalFile on a >256 MiB local image/video; pointing srcPath at a huge source file by mistake (e.g. a raw design file rather than the exported asset); a downloaded asset that was placed on disk by another step and exceeds the cap.","commonSituations":"User drops a large pre-rendered video into the project and the import flow calls freezeLocalFile on it; srcPath resolves to the wrong file (typo) hitting a huge file; a screen-recording asset that's too large.","solutions":["Compress or downscale the source file below 256 MiB before importing.","Verify srcPath points at the intended exported asset, not a raw/source file.","For video, transcode to a lower bitrate or resolution.","If a genuine large asset is required and you accept the disk cost, raise MAX_FREEZE_BYTES in a fork."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { statSync } from 'node:fs';\nimport { exceedsFreezeCap } from '.../figma/freeze';\nexport function assertLocalUnderCap(srcPath: string): void {\n  const size = statSync(srcPath).size;\n  if (exceedsFreezeCap(size)) {\n    throw new Error(`${srcPath} is ${size} bytes — compress below the 256 MiB cap first`);\n  }\n}\nassertLocalUnderCap(srcPath);\nfreezeLocalFile(srcPath, dest);","typeGuard":null,"tryCatchPattern":"try {\n  freezeLocalFile(srcPath, dest);\n} catch (err) {\n  if (err instanceof Error && /exceeds .* cap/.test(err.message)) {\n    // prompt user to compress/transcode the source file\n  } else throw err;\n}","preventionTips":["Compress or transcode large local assets below the cap before importing.","Verify srcPath points at the intended asset, not a raw source file.","Run statSync-based pre-checks so the error message names the file path."],"tags":["figma","freeze","size-limit","filesystem","assets"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}