Skip to content

@remotion/cli: Accept --props files saved with a UTF-8 BOM - #12645

Merged
JonnyBurger merged 1 commit into
remotion-dev:mainfrom
b84330808:cli-props-file-bom
Oct 28, 2026
Merged

JonnyBurger merged 1 commit into
remotion-dev:mainfrom
b84330808:cli-props-file-bom

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

On Windows, --props=props.json fails when the file starts with a UTF-8 BOM. Windows PowerShell 5.1 writes one with Out-File -Encoding utf8 / Set-Content -Encoding utf8, and some editors do too. JSON.parse() rejects the BOM, so the CLI prints "You passed --props but it was neither valid JSON nor a file path to a valid JSON file", and the Windows hint then suggests passing a JSON file path, which is the same file.

'{"title": "Hello"}' | Out-File -Encoding utf8 props.json
npx remotion render MyComp --props=props.json

This strips a leading BOM before parsing, both on the first read and when the Studio re-reads the watched file.

Before / after: calling the built getInputProps() with that PowerShell-written file exits 1 with the error above on main, and returns {"title":"Hello"} with this change. The new src/test/get-input-props.test.ts fails on main and passes here; bun test src in packages/cli passes.

@remotion/lambda's --webhook-custom-data reads files the same way; I can send that separately if you want it.

I used Claude Code to write this change.

Windows PowerShell 5.1 (`Out-File -Encoding utf8`, `Set-Content -Encoding utf8`)
and some editors write a UTF-8 BOM. JSON.parse() rejects it, so
`--props=props.json` failed with "neither valid JSON nor a file path to a
valid JSON file", and the Windows hint pointed users at the same file.

Strip a leading BOM before parsing, both on the first read and when the
watched file changes in the Studio.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
bugs Ready Ready Preview Oct 27, 2026 3:04pm UTC
remotion Ready Ready Preview Oct 27, 2026 3:04pm UTC

Request Review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Strip leading UTF-8 BOM before parsing --props file — get-input-props.ts now removes a leading \uFEFF from the file contents on both the initial read and the watched-file re-read, so PowerShell 5.1 / editor-authored JSON files parse correctly.
  • Regression test — new src/test/get-input-props.test.ts writes a BOM-prefixed JSON file and asserts getInputProps() returns the parsed object, matching the existing config-reload.test.ts temp-dir/spy conventions.

The fix is correct and matches the convention already used in captions/src/parse-srt.ts and parse-vtt.ts. I ran the new test locally (bun test src/test/get-input-props.test.ts) and it passes. The parallel bug in @remotion/lambda's get-webhook-custom-data.ts is already called out in the PR description as a follow-up.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash | 𝕏

@JonnyBurger
JonnyBurger merged commit d80fc1b into remotion-dev:main Oct 28, 2026
20 checks passed
@JonnyBurger

Copy link
Copy Markdown
Member

Thank you!

This branch was successfully deployed

2 active deployments
Preview – remotion — 9ae9b125 Deployed Oct 27, 2026 by vercel[bot]
Preview – bugs — 9ae9b125 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants