heygen-com/hyperframes · error · Error

figma render download failed: content-length ${declared} exc

Error message

figma render download failed: content-length ${declared} exceeds ${MAX_FREEZE_BYTES} cap

What it means

Thrown by downloadRender() before buffering the body: it reads the response content-length header and rejects it if it exceeds MAX_FREEZE_BYTES (256 MiB). This is the ponytail disk-fill guard — a hostile or runaway source cannot exhaust disk through an oversized render. The cap value is interpolated into the message.

Source

Thrown at packages/cli/src/commands/figma/download.ts:11

import { exceedsFreezeCap, MAX_FREEZE_BYTES } from "@hyperframes/core/figma";

/** Fetch a short-lived figma CDN render url into bytes. */
export async function downloadRender(url: string): Promise<Uint8Array> {
  const res = await fetch(url);
  if (!res.ok) throw new Error(`figma render download failed: HTTP ${res.status}`);
  // Reject oversized responses before buffering the body — the freeze cap
  // alone only fires after the full allocation.
  const declared = Number(res.headers.get("content-length") ?? 0);
  if (exceedsFreezeCap(declared))
    throw new Error(
      `figma render download failed: content-length ${declared} exceeds ${MAX_FREEZE_BYTES} cap`,
    );
  return new Uint8Array(await res.arrayBuffer());
}

View on GitHub (pinned to c2996c8626)

Solutions

  1. Lower --scale (e.g. 2 or 1)
  2. Export a smaller node, or split a large frame into smaller nodes
  3. Switch format — svg of complex frames can be enormous; png at modest scale is usually far smaller

Example fix

// before
hyperframes figma asset AAA:1:2 --format svg --scale 4
// after
hyperframes figma asset AAA:1:2 --format png --scale 2
Defensive patterns

Strategy: validation

Validate before calling

import { MAX_FREEZE_BYTES } from '@hyperframes/core/figma';
// Before requesting a render, cap the scale to keep the expected payload under 256 MiB.
const safeScale = Math.min(requestedScale ?? 1, 2); // svg of complex frames is large; start low

Prevention

When it happens

Trigger: A render whose declared size is over 256 MiB: a very high --scale on a large frame, or an svg export of an extremely complex vector tree. The check fires on the declared content-length, before any byte is buffered.

Common situations: Passing --scale 4 on a big frame; exporting a dense illustration as svg at high scale; an unexpected huge payload from figma.

Related errors


AI-assisted analysis of heygen-com/hyperframes@c2996c8626 (2026-08-12). Data as JSON: /api/errors/09ef1b7b67e8135e. Report an issue: GitHub.