heygen-com/hyperframes · critical · Error
Missing contrast audit browser script
Error message
Missing contrast audit browser script
What it means
Thrown by loadContrastAuditScript when neither candidate location for the bundled contrast-audit.browser.js exists. This file is a build artifact injected into the headless browser to run WCAG contrast checks during `hyperframes check`; its absence means the CLI package is missing compiled assets.
Source
Thrown at packages/cli/src/commands/validate.ts:326
if (typeof restore === "function") (restore as () => void)();
});
}
}
return results;
}
function loadContrastAuditScript(): string {
const candidates = [
join(__dirname, "contrast-audit.browser.js"),
join(__dirname, "commands", "contrast-audit.browser.js"),
];
for (const candidate of candidates) {
if (existsSync(candidate)) return readFileSync(candidate, "utf-8");
}
throw new Error("Missing contrast audit browser script");
}
/**
* Pull the `missing_or_empty_sub_composition` lint findings out of a
* `lintProject` result and shape them as `ConsoleEntry`s. Extracted as a
* pure function so it's testable without a headless browser or a real
* project directory — see validate.test.ts.
*/
export function extractCompositionErrorsFromLint(
lintResult: Pick<ProjectLintResult, "results">,
): ConsoleEntry[] {
return lintResult.results
.flatMap((r) => r.result.findings)
.filter((f) => f.code === "missing_or_empty_sub_composition" && f.severity === "error")
.map((f) => ({ level: "error" as const, text: f.message }));
}
// Match the render pipeline: localize remote <img>/<video>/<audio>/@font-faceView on GitHub (pinned to c2996c8626)
Solutions
- Reinstall the CLI from a clean state: `npm i -g hyperframes@latest`
- If running from source, build first: `bun run build` to emit the browser bundle
- Verify the file exists under the installed commands/ directory
- Run a non-contrast subset of checks as a temporary workaround
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from "node:fs";
import { join } from "node:path";
function contrastScriptPresent(): boolean {
return [join(__dirname, "contrast-audit.browser.js"),
join(__dirname, "commands", "contrast-audit.browser.js")]
.some(existsSync);
} Prevention
- Install the CLI cleanly from the official tarball so build assets ship
- Run `bun run build` from source before validate
- Don't prune the package's compiled browser bundles
When it happens
Trigger: validate's contrast audit path calls loadContrastAuditScript, which tries join(__dirname,'contrast-audit.browser.js') and join(__dirname,'commands','contrast-audit.browser.js'). Both existsSync checks fail → throw at validate.ts:326.
Common situations: Running from a source tree without building; a corrupted/partial npm install that stripped JS assets; an over-pruned Docker image; referencing a forked CLI that didn't ship the browser bundle.
Related errors
AI-assisted analysis of heygen-com/hyperframes@c2996c8626 (2026-08-12).
Data as JSON: /api/errors/c393540c019d6d73.
Report an issue: GitHub.