{"record":{"id":"27b61a2cb92f2f69","repo":"remotion-dev/remotion","slug":"caching-flag-must-be-a-boolean","errorCode":null,"errorMessage":"Caching flag must be a boolean.","messagePattern":"Caching flag must be a boolean\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/webpack-caching.ts","lineNumber":7,"sourceCode":"export const DEFAULT_WEBPACK_CACHE_ENABLED = true;\n\nlet webpackCaching = DEFAULT_WEBPACK_CACHE_ENABLED;\n\nexport const setWebpackCaching = (flag: boolean) => {\n\tif (typeof flag !== 'boolean') {\n\t\tthrow new TypeError('Caching flag must be a boolean.');\n\t}\n\n\twebpackCaching = flag;\n};\n\nexport const getWebpackCaching = () => {\n\treturn webpackCaching;\n};\n","sourceCodeStart":1,"sourceCodeEnd":16,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cli/src/config/webpack-caching.ts#L1-L16","documentation":"`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.","triggerScenarios":"Calling `Config.setWebpackCaching('true')`, `setWebpackCaching(1)`, `setWebpackCaching(null)`, or `setWebpackCaching(undefined)`.","commonSituations":"Reading a flag from `process.env.CACHE` (always a string); deserializing a JSON config value as a string; copy-pasting `'false'` from docs.","solutions":["Pass a literal boolean: `Config.setWebpackCaching(false)`.","For env-driven values, coerce: `Config.setWebpackCaching(process.env.CACHE !== 'false')`."],"exampleFix":"// before\nConfig.setWebpackCaching(process.env.CACHE);\n// after\nConfig.setWebpackCaching(process.env.CACHE !== 'false');","handlingStrategy":"type-guard","validationCode":"const raw = process.env.CACHE !== 'false'; // already boolean\nif (typeof raw !== 'boolean') {\n  throw new Error('CACHE must resolve to a boolean');\n}\nConfig.setWebpackCaching(raw);","typeGuard":"const isBoolean = (v: unknown): v is boolean => typeof v === 'boolean';","tryCatchPattern":null,"preventionTips":["Derive booleans from env via explicit comparisons, never by truthiness.","Keep a typed config layer between env and Remotion setters."],"tags":["config","validation","typescript","webpack","caching"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}