remotion-dev/remotion · error · TypeError
Caching flag must be a boolean.
Error message
Caching flag must be a boolean.
What it means
`Config.setWebpackCaching()` toggles whether the bundler caches its output between runs. It runs a strict `typeof flag !== 'boolean'` check and throws a TypeError on anything else — no coercion.
Source
Thrown at packages/cli/src/config/webpack-caching.ts:7
export const DEFAULT_WEBPACK_CACHE_ENABLED = true;
let webpackCaching = DEFAULT_WEBPACK_CACHE_ENABLED;
export const setWebpackCaching = (flag: boolean) => {
if (typeof flag !== 'boolean') {
throw new TypeError('Caching flag must be a boolean.');
}
webpackCaching = flag;
};
export const getWebpackCaching = () => {
return webpackCaching;
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass a literal boolean: `Config.setWebpackCaching(false)`.
- For env-driven values, coerce: `Config.setWebpackCaching(process.env.CACHE !== 'false')`.
Example fix
// before Config.setWebpackCaching(process.env.CACHE); // after Config.setWebpackCaching(process.env.CACHE !== 'false');
Defensive patterns
Strategy: type-guard
Validate before calling
const raw = process.env.CACHE !== 'false'; // already boolean
if (typeof raw !== 'boolean') {
throw new Error('CACHE must resolve to a boolean');
}
Config.setWebpackCaching(raw); Type guard
const isBoolean = (v: unknown): v is boolean => typeof v === 'boolean';
Prevention
- Derive booleans from env via explicit comparisons, never by truthiness.
- Keep a typed config layer between env and Remotion setters.
When it happens
Trigger: Calling `Config.setWebpackCaching('true')`, `setWebpackCaching(1)`, `setWebpackCaching(null)`, or `setWebpackCaching(undefined)`.
Common situations: Reading a flag from `process.env.CACHE` (always a string); deserializing a JSON config value as a string; copy-pasting `'false'` from docs.
Related errors
- Polling must be a number or null, got ${JSON.stringify(
- setImageSequence accepts a Boolean Value
- outputLocation must be a string but got ${typeof newOutputLo
- Studio server port should be a number. Got ${typeof port} ($
- "fps" must be a number, but you passed a value of type ${typ
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/27b61a2cb92f2f69.
Report an issue: GitHub.