Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(cli): surface HYPERFRAMES_BROWSER_PATH hint on Windows chrome-headless-shell launch crashes (#2481)
Vance Ingalls7563b644a2f5
diff --git a/packages/cli/src/browser/windowsCrash.test.ts b/packages/cli/src/browser/windowsCrash.test.tsnew file mode 100644index 0000000000..9be0da3ba0--- /dev/null+++ b/packages/cli/src/browser/windowsCrash.test.ts@@ -0,0 +1,67 @@+import { describe, it, expect } from "vitest";+import { isWindowsChromeCrashError, windowsChromeCrashRemediation } from "./windowsCrash.js";++describe("isWindowsChromeCrashError", () => {+ it("matches Puppeteer launch-failure wrapper + decimal exit code", () => {+ expect(+ isWindowsChromeCrashError(+ "Failed to launch the browser process! Code: 3221225595, with no stderr.",+ ),+ ).toBe(true);+ });++ it("matches Puppeteer launch-failure wrapper + hex exit code", () => {+ expect(+ isWindowsChromeCrashError("Failed to launch the browser process (exited with 0xC0000409)"),+ ).toBe(true);+ });++ it("matches Puppeteer launch-failure wrapper + named Windows status symbol", () => {+ expect(+ isWindowsChromeCrashError(+ "Failed to launch the browser process — STATUS_STACK_BUFFER_OVERRUN",+ ),+ ).toBe(true);+ });++ it("does not match a launch failure without the crash-code signal", () => {+ // Linux shared-library launch failures land in the sibling+ // chromeLaunchRemediation path, not this one.+ expect(+ isWindowsChromeCrashError(+ "Failed to launch the browser process (libnss3.so: cannot open shared object file)",+ ),+ ).toBe(false);+ });++ it("does not match the crash code alone without the launch-failure wrapper", () => {+ expect(isWindowsChromeCrashError("some other Windows process exited with 3221225595")).toBe(+ false,+ );+ });++ it("does not match unrelated errors", () => {+ expect(isWindowsChromeCrashError("Composition HTML is empty")).toBe(false);+ });+});++describe("windowsChromeCrashRemediation", () => {+ it("returns undefined off Windows even for a matching error", () => {+ if (process.platform === "win32") return;+ expect(+ windowsChromeCrashRemediation("Failed to launch the browser process! Code: 3221225595"),+ ).toBeUndefined();+ });++ it("returns undefined for non-launch errors on any platform", () => {+ expect(windowsChromeCrashRemediation("Composition HTML is empty")).toBeUndefined();+ });++ it("returns undefined for a launch failure without the crash code on any platform", () => {+ expect(+ windowsChromeCrashRemediation(+ "Failed to launch the browser process (libnss3.so cannot open)",+ ),+ ).toBeUndefined();+ });+});diff --git a/packages/cli/src/browser/windowsCrash.ts b/packages/cli/src/browser/windowsCrash.tsnew file mode 100644index 0000000000..9c675cf54a--- /dev/null+++ b/packages/cli/src/browser/windowsCrash.ts@@ -0,0 +1,50 @@+/**+ * Detection + remediation for Windows chrome-headless-shell launch crashes.+ *+ * Field feedback (#hyperframes-cli-feedback ts=1784116246, win32/x64,+ * HyperFrames CLI 0.7.58) hit the exact error+ * `Failed to launch the browser process ... Code: 3221225595` with no stderr.+ * Exit code 3221225595 == 0xC0000409 == STATUS_STACK_BUFFER_OVERRUN — a Windows+ * stack-corruption fatal reported against the pinned chrome-headless-shell+ * binary on some Win10/Win11 hosts (typically pre-24H2 or particular AV/EDR+ * combinations). The reporter recovered by pointing `HYPERFRAMES_BROWSER_PATH`+ * at their system Chrome; the render then used the screenshot fallback and+ * produced a complete MP4.+ *+ * The generic "Try --docker" hint the CLI already emits doesn't name that env+ * var, so the workaround is undiscoverable unaided. Sibling failure mode to+ * the download-time hint added in #2443 and the closed-with-invite #2078+ * (SIGTRAP at launch on macOS arm64); same `HYPERFRAMES_BROWSER_PATH`+ * remediation, different trigger + platform.+ *+ * The match is gated on both the Puppeteer launch-failure wrapper text AND the+ * specific crash-code signal (decimal, hex, or symbol name) so unrelated+ * Windows launch failures — which need different remediation — don't+ * mis-fire this hint.+ */++const STATUS_STACK_BUFFER_OVERRUN_DEC = "3221225595";+const STATUS_STACK_BUFFER_OVERRUN_HEX = /0x[cC]0000409/;+const STATUS_STACK_BUFFER_OVERRUN_NAME = /STATUS_STACK_BUFFER_OVERRUN/i;++export function isWindowsChromeCrashError(errorMessage: string): boolean {+ if (!/Failed to launch the browser process/i.test(errorMessage)) return false;+ return (+ errorMessage.includes(STATUS_STACK_BUFFER_OVERRUN_DEC) ||+ STATUS_STACK_BUFFER_OVERRUN_HEX.test(errorMessage) ||+ STATUS_STACK_BUFFER_OVERRUN_NAME.test(errorMessage)+ );+}++export function windowsChromeCrashRemediation(errorMessage: string): string | undefined {+ if (process.platform !== "win32") return undefined;+ if (!isWindowsChromeCrashError(errorMessage)) return undefined;+ return [+ "chrome-headless-shell crashed at launch (Windows STATUS_STACK_BUFFER_OVERRUN, exit 0xC0000409 / 3221225595).",+ "The pinned Chromium build is not stable on this Windows host; point hyperframes at your installed Chrome instead:",+ "",+ ' set HYPERFRAMES_BROWSER_PATH="C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"',+ "",+ "Then re-run your command. Any Chrome build works for the screenshot capture path; install a real chrome-headless-shell later if you need the perf-optimized BeginFrame path.",+ ].join("\n");+}diff --git a/packages/cli/src/commands/render.ts b/packages/cli/src/commands/render.tsindex 06d03da67d..bb3307d431 100644--- a/packages/cli/src/commands/render.ts+++ b/packages/cli/src/commands/render.ts@@ -79,6 +79,7 @@ import { runEnvironmentChecks } from "../browser/preflight.js";import { detectH264EncoderMode } from "../browser/ffmpeg.js";import { chromeLaunchRemediation } from "../browser/linuxDeps.js";import { macosOldChromeCrashRemediation } from "../browser/macosOldChromeCrash.js";+import { windowsChromeCrashRemediation } from "../browser/windowsCrash.js";import { killOrphanedProcesses } from "../utils/orphanCleanup.js";import {markRenderSucceeded,@@ -1433,6 +1434,20 @@ function handleRenderError(errorBox("Render failed — Chrome could not launch", message, macosRemediation);failCommand();}+ // Windows chrome-headless-shell can crash at launch with+ // STATUS_STACK_BUFFER_OVERRUN (exit 0xC0000409 / 3221225595). Same+ // HYPERFRAMES_BROWSER_PATH remediation as the download-time hint (#2443)+ // and the closed-with-invite arm64 macOS sibling (#2078). Field feedback+ // ts=1784116246.+ const windowsRemediation = windowsChromeCrashRemediation(message);+ if (windowsRemediation) {+ errorBox(+ "Render failed — chrome-headless-shell crashed at launch",+ message,+ windowsRemediation,+ );+ failCommand();+ }errorBox("Render failed", message, hint);failCommand();}