Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(cli): surface HYPERFRAMES_BROWSER_PATH hint on macOS <13 chrome-headless-shell dyld crash
Via0d16f19b07b1
diff --git a/packages/cli/src/browser/macosOldChromeCrash.test.ts b/packages/cli/src/browser/macosOldChromeCrash.test.tsnew file mode 100644index 0000000000..0674bc9beb--- /dev/null+++ b/packages/cli/src/browser/macosOldChromeCrash.test.ts@@ -0,0 +1,100 @@+import { describe, it, expect } from "vitest";+import {+ isMacosOldChromeCrashError,+ macosOldChromeCrashRemediation,+} from "./macosOldChromeCrash.js";++describe("isMacosOldChromeCrashError", () => {+ it("matches Puppeteer launch-failure wrapper + dyld Symbol-not-found + macOS-13 VideoToolbox symbol", () => {+ expect(+ isMacosOldChromeCrashError(+ "Failed to launch the browser process!\n" ++ "dyld: Symbol not found: _kVTCompressionPropertyKey_ReferenceBufferCount\n" ++ " Referenced from: /Users/x/.cache/puppeteer/chrome-headless-shell/mac-152.0.7928.2/chrome-headless-shell\n" ++ " Expected in: /System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox",+ ),+ ).toBe(true);+ });++ it("matches the VideoToolbox framework signal even without the exact ReferenceBufferCount symbol name", () => {+ // Future pinned builds may hit a sibling VT symbol from the same framework+ // (they all migrated to macOS 13); the framework signal is enough to fire+ // the same remediation.+ expect(+ isMacosOldChromeCrashError(+ "Failed to launch the browser process. Symbol not found: _kVTSomeFutureSymbol from VideoToolbox",+ ),+ ).toBe(true);+ });++ it("does not match a launch failure without dyld Symbol-not-found", () => {+ expect(+ isMacosOldChromeCrashError(+ "Failed to launch the browser process (libnss3.so: cannot open shared object file)",+ ),+ ).toBe(false);+ });++ it("does not match a darwin Symbol-not-found from an unrelated framework (needs different remediation)", () => {+ expect(+ isMacosOldChromeCrashError(+ "Failed to launch the browser process. dyld: Symbol not found: _some_libcxx_symbol from libc++.dylib",+ ),+ ).toBe(false);+ });++ it("does not match the symbol name alone without the launch-failure wrapper", () => {+ expect(+ isMacosOldChromeCrashError(+ "unrelated tool crashed with Symbol not found: _kVTCompressionPropertyKey_ReferenceBufferCount",+ ),+ ).toBe(false);+ });++ it("does not match unrelated errors", () => {+ expect(isMacosOldChromeCrashError("Composition HTML is empty")).toBe(false);+ });+});++describe("macosOldChromeCrashRemediation", () => {+ it("returns undefined off darwin even for a matching error", () => {+ if (process.platform === "darwin") return;+ expect(+ macosOldChromeCrashRemediation(+ "Failed to launch the browser process. dyld: Symbol not found: _kVTCompressionPropertyKey_ReferenceBufferCount from VideoToolbox",+ ),+ ).toBeUndefined();+ });++ it("returns undefined for non-launch errors on any platform", () => {+ expect(macosOldChromeCrashRemediation("Composition HTML is empty")).toBeUndefined();+ });++ it("returns undefined for a launch failure without the dyld signal on any platform", () => {+ expect(+ macosOldChromeCrashRemediation(+ "Failed to launch the browser process (libnss3.so cannot open)",+ ),+ ).toBeUndefined();+ });++ it("returns undefined for a darwin dyld failure from an unrelated framework", () => {+ if (process.platform !== "darwin") return;+ expect(+ macosOldChromeCrashRemediation(+ "Failed to launch the browser process. Symbol not found: _some_libcxx_symbol from libc++.dylib",+ ),+ ).toBeUndefined();+ });++ it("mentions HYPERFRAMES_BROWSER_PATH and the PRODUCER_HEADLESS_SHELL_PATH alias when firing on darwin", () => {+ if (process.platform !== "darwin") return;+ const remediation = macosOldChromeCrashRemediation(+ "Failed to launch the browser process. dyld: Symbol not found: _kVTCompressionPropertyKey_ReferenceBufferCount from VideoToolbox",+ );+ expect(remediation).toBeDefined();+ expect(remediation).toMatch(/HYPERFRAMES_BROWSER_PATH/);+ expect(remediation).toMatch(/PRODUCER_HEADLESS_SHELL_PATH/);+ expect(remediation).toMatch(/chrome-headless-shell@150/);+ });+});diff --git a/packages/cli/src/browser/macosOldChromeCrash.ts b/packages/cli/src/browser/macosOldChromeCrash.tsnew file mode 100644index 0000000000..031caa7e24--- /dev/null+++ b/packages/cli/src/browser/macosOldChromeCrash.ts@@ -0,0 +1,73 @@+// fallow-ignore-file code-duplication+/**+ * Detection + remediation for macOS-below-13 chrome-headless-shell dyld+ * launch crashes.+ *+ * Field feedback (#hyperframes-cli-feedback ts=1784227832, darwin/x64,+ * macOS 12, HyperFrames CLI 0.7.60) hit+ * `dyld: Symbol not found: _kVTCompressionPropertyKey_ReferenceBufferCount`+ * from `VideoToolbox` when launching the pinned+ * `chrome-headless-shell mac-152.0.7928.2`. The symbol was added in+ * macOS 13; older hosts cannot resolve it, so the binary aborts at load+ * before any browser process starts.+ *+ * The reporter recovered by installing an older shell (v150) via+ * `@puppeteer/browsers install chrome-headless-shell@150` and pointing+ * `PRODUCER_HEADLESS_SHELL_PATH` at it. Their check/snapshot commands+ * accepted that older cached shell (they don't force the pinned build),+ * but the render command required v152 via `preferManagedChrome: true`+ * and therefore could not fall back on its own. The generic+ * "Try --docker for containerized rendering" hint didn't name any of+ * the browser-path env vars, so the workaround is undiscoverable+ * unaided.+ *+ * Same discoverability class as #2443 (download failure), #2078 (arm64+ * SIGTRAP at launch), and #2481 (Windows STATUS_STACK_BUFFER_OVERRUN):+ * detect the launch-time crash signal, surface `HYPERFRAMES_BROWSER_PATH`+ * (and its `PRODUCER_HEADLESS_SHELL_PATH` alias — see #2471) with a+ * concrete macOS example.+ *+ * The match is gated on the Puppeteer launch-failure wrapper text AND+ * the dyld symbol-not-found signal AND a macOS-13-only symbol, so+ * unrelated darwin launch failures do not mis-fire this hint. The+ * symbol-name signal is macOS-version-specific by construction:+ * `_kVTCompressionPropertyKey_ReferenceBufferCount` only exists on+ * macOS 13+, so if a user's dyld cannot find it, their host is <13.+ * That means we do not need a separate `os.release()` gate — the+ * signal itself is the version discriminator.+ */++const DYLD_SYMBOL_NOT_FOUND = /Symbol not found:/i;+const MACOS_13_ONLY_SYMBOL = /_kVTCompressionPropertyKey_ReferenceBufferCount/;+const VIDEO_TOOLBOX = /VideoToolbox/;++export function isMacosOldChromeCrashError(errorMessage: string): boolean {+ if (!/Failed to launch the browser process/i.test(errorMessage)) return false;+ if (!DYLD_SYMBOL_NOT_FOUND.test(errorMessage)) return false;+ // Both signals must be present. The specific macOS-13-only symbol is what+ // makes this hint safe to fire (any other Symbol-not-found on darwin+ // needs different remediation — a shared-lib install, an Xcode SDK+ // mismatch, etc. — none of which are fixed by HYPERFRAMES_BROWSER_PATH).+ // We also require VideoToolbox to catch the case where a future pinned+ // build hits a different `_kVT…` symbol from the same framework.+ return MACOS_13_ONLY_SYMBOL.test(errorMessage) || VIDEO_TOOLBOX.test(errorMessage);+}++export function macosOldChromeCrashRemediation(errorMessage: string): string | undefined {+ if (process.platform !== "darwin") return undefined;+ if (!isMacosOldChromeCrashError(errorMessage)) return undefined;+ return [+ "chrome-headless-shell crashed at launch (macOS dyld: Symbol not found in VideoToolbox).",+ "The pinned Chromium build requires macOS 13+; on macOS 12 or older, install an older",+ "chrome-headless-shell and point hyperframes at it:",+ "",+ " npx @puppeteer/browsers install chrome-headless-shell@150",+ ' export HYPERFRAMES_BROWSER_PATH="$HOME/.cache/puppeteer/chrome-headless-shell/mac-150.0.7422.0/chrome-headless-shell-mac-x64/chrome-headless-shell"',+ "",+ "(PRODUCER_HEADLESS_SHELL_PATH works as an alias for the same override.)",+ "Any working chrome-headless-shell build resolves this — the exact version above is one",+ "known-good macOS-12 combination. Alternatively, point HYPERFRAMES_BROWSER_PATH at your",+ 'installed Google Chrome ("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")',+ "to fall back to the screenshot capture path.",+ ].join("\n");+}diff --git a/packages/cli/src/commands/render.ts b/packages/cli/src/commands/render.tsindex 445f86a59f..b46d05a514 100644--- a/packages/cli/src/commands/render.ts+++ b/packages/cli/src/commands/render.ts@@ -80,6 +80,7 @@ import { formatRenderOutputTimestamp } from "@hyperframes/core";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 { killOrphanedProcesses } from "../utils/orphanCleanup.js";import {markRenderSucceeded,@@ -2106,6 +2107,14 @@ function handleRenderError(errorBox("Render failed — Chrome could not launch", message, remediation);process.exit(1);}+ // macOS <13 dyld Symbol-not-found on the pinned chrome-headless-shell+ // build. Different remediation shape (older shell + env-var override)+ // than the Linux shared-lib install, so it lives in its own detector.+ const macosRemediation = macosOldChromeCrashRemediation(message);+ if (macosRemediation) {+ errorBox("Render failed — Chrome could not launch", message, macosRemediation);+ process.exit(1);+ }errorBox("Render failed", message, hint);process.exit(1);}