Repository navigation
fix(cli): render --json gives each missing tool, a held slot and an old Node its own code - #7842
Open
wonjangcloud9 wants to merge 2 commits into
Open
wonjangcloud9 wants to merge 2 commits into
wonjangcloud9 wants to merge 2 commits into
Conversation
…ld Node its own code Every failed `render --json` answered with `error.code: "runtime_error"`, so a script could only tell a missing FFmpeg from a busy render slot by matching the human message. A CliRuntimeError now carries a code, as CliUsageError does, and the envelope reports it: chrome_not_found, ffmpeg_not_found, ffprobe_not_found, render_locked. A Node older than 22 prints the envelope too (node_version_unsupported) when the run asked for --json. Other failures keep runtime_error. Refs heygen-com#7408 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
… export bin/hyperframes.mjs now imports runtimeVersionJson, so the stub dist file binEntry.test.ts writes must export it too, or the bin fails to load.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A failed
hyperframes render --jsonnow says which failure it was inerror.code:error.codebeforeHYPERFRAMES_BROWSER_PATH, or none installed and it cannot be installed)runtime_errorchrome_not_foundruntime_errorffmpeg_not_foundruntime_errorffprobe_not_found--no-waitwhile another render holds the slotruntime_errorrender_lockednode_version_unsupported(stderr text unchanged)Every other failure keeps
runtime_error. Messages, hints, exit codes and stderr are unchanged.Why
#7408: a script or agent running
render --jsoncould only tell these failures apart by matching the humanmessagetext. They call for different reactions (install a tool, wait and retry, switch Node), so the code should carry the difference.Related work
Refs #7408. This covers the first "Done when" item of that issue (cases 2–6 and 9). It deliberately leaves the other two — a JSON object on SIGINT/SIGTERM and on success — out: both change what a
--jsonrun prints on stdout today (nothing), and the issue is labeledtriage/needs-design, so I did not want to pick that contract for you. Happy to follow up on those once the shape is decided.No open PR touches this (searched by issue number and by the code names).
How
CliRuntimeErrortakes acodeoption, the wayCliUsageErroralready does (defaultruntime_error), andfailCommand(exitCode, cause, code)passes it through.errorCode()inutils/jsonError.tsreads it from either typed error.browser/preflight.ts) setscodeon the three "not found" outcomes;executeLocalRenderfails with the code of the last failed check, which is the one whose title the envelope already reports asmessage(socodeandmessagealways describe the same check). "FFmpeg cannot start", "Chrome cannot start", missing shared libraries and low disk space keepruntime_error.ensureBrowserForRender(render/execute.ts) andacquireRenderSlot(render/renderSlot.ts) passchrome_not_foundandrender_locked.bin/hyperframes.mjsruns before anything else is loaded, so the Node check prints its own envelope (runtimeVersionJson) when--jsonis on the command line, next to the unchanged stderr line.docs/packages/cli.mdx: a table of these codes under the--jsonfailure envelope.Test plan
utils/jsonError.test.ts(a runtime error's own code, with the reported failure and with a cause),browser/preflight.test.ts(the three not-found outcomes carry their code),utils/renderLock.test.ts(acquireRenderSlotunder--no-waitfails withrender_locked),runtimeVersion.test.ts(envelope only for a--jsonrun).npx vitest runoversrc/utils,src/browser,src/commands/render: the only 3 failures (publishProject.test.tsUnicode-form case, 2 WebGL cases incheckSweep.chromium.test.ts) fail the same way onmainon this machine.main(e426ce4) vs this branch, same project and same commands (render . --json --quality draft --workers 2 -o out.mp4, stdout only):Unchanged on both: a successful render (exit 0, empty stdout, same 13,336-byte mp4) and an unrelated failure (
render ./nope-dir --json→runtime_error, "Not a directory: …"). Not run by hand: the "no Chrome installed and offline" case — it goes through the sameChrome not foundoutcome as the bad-path case and is covered by the preflight unit test.scripts/comment-ratchet.mjspasses)Also run locally: oxlint, oxfmt
--check,tsc --noEmit(cli),fallow audit --base origin/main,check:cli-process-ownership,check-docs-cli-commands.mjs.🤖 Generated with Claude Code