heygen-com/hyperframes · error · Error

Selected media has no analyzable src

Error message

Selected media has no analyzable src

What it means

Thrown by mediaSourceForElement() in packages/cli/src/commands/media-treatment.ts:479. It reads element.getAttribute('src'), and for <video> also falls back to the first <source> child's src. If neither yields a truthy value, it throws — analysis requires a concrete media URL to probe with ffprobe.

Source

Thrown at packages/cli/src/commands/media-treatment.ts:485

  return { html: patched.html, changed: true, tag, value, before, after };
}

function parseSelectorIndex(raw: string | undefined): number | undefined {
  if (raw === undefined) return undefined;
  const value = Number(raw);
  if (!Number.isInteger(value) || value < 0) {
    throw new Error("--selector-index must be a non-negative integer");
  }
  return value;
}

function mediaSourceForElement(element: Element): string {
  const src =
    element.getAttribute("src") ??
    (element.tagName.toLowerCase() === "video"
      ? element.querySelector("source")?.getAttribute("src")
      : null);
  if (!src) throw new Error("Selected media has no analyzable src");
  return src;
}

export function resolveMediaTreatmentSource(
  projectDir: string,
  compositionFile: string,
  source: string,
): string {
  const sourceUrl = source.trim();
  if (!sourceUrl) throw new Error("Selected media has no analyzable local src");
  if (isRemoteOrInlineUrl(sourceUrl)) {
    throw new Error(
      "Media analysis requires a local project asset; freeze remote media with media-use first",
    );
  }
  const cleanSource = cleanAssetUrl(sourceUrl);
  if (!cleanSource) throw new Error("Selected media has no analyzable local src");
  const projectRelative = cleanSource.startsWith("/")

View on GitHub (pinned to c2996c8626)

Solutions

  1. Ensure the matched <img>/<video> has a real src attribute (or a <source> child with src for video) in static HTML.
  2. For lazy-loaded media, materialize the src (copy data-src to src) before analysis.
  3. If the media is remote, freeze it locally with `hyperframes media-use` first so a local src exists.

Example fix

<!-- before -- no src to analyze -->
<img id="hero" data-src="hero.png">
<!-- after -->
<img id="hero" src="hero.png">
Defensive patterns

Strategy: type-guard

Validate before calling

function hasAnalyzableSrc(el: Element): boolean {
  if (el.getAttribute('src')) return true;
  if (el.tagName.toLowerCase() === 'video') {
    return Boolean(el.querySelector('source')?.getAttribute('src'));
  }
  return false;
}

Type guard

function hasAnalyzableSrc(el: Element): boolean {
  if (el.getAttribute('src')) return true;
  if (el.tagName.toLowerCase() === 'video') {
    return Boolean(el.querySelector('source')?.getAttribute('src'));
  }
  return false;
}

Try / catch

try {
  mediaSourceForElement(element);
} catch (error) {
  if (/no analyzable src/.test(String(error))) {
    // materialize data-src into src, or skip analysis for this element
    throw new Error('Element has no src; materialize data-src or set a real src first.');
  }
  throw error;
}

Prevention

When it happens

Trigger: An <img> with no src attribute; a <video> with neither a src attribute nor a <source> child with src; an element whose src was intentionally blank.

Common situations: Lazy-loaded images using data-src instead of src; <video> whose sources are set by client-side JS; <picture> where the <img> has no src; placeholder elements; src attribute empty.

Related errors


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