{"record":{"id":"c9f37971f24cc6c6","repo":"remotion-dev/remotion","slug":"content-must-be-a-non-empty-string-but-got-json-stringify","errorCode":null,"errorMessage":"\"content\" must be a non-empty string, but got ${JSON.stringify(params.content)}","messagePattern":"\"content\" must be a non-empty string, but got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/effects/src/lut/index.ts","lineNumber":87,"sourceCode":"\t\t\tparsedLuts.delete(oldestContent);\n\t\t}\n\t}\n\n\treturn created;\n};\n\nconst validateLutParams = (params: LutParams): void => {\n\tif (params === null || typeof params !== 'object') {\n\t\tthrow new TypeError(\n\t\t\t`LUT effect requires a parameters object, but got ${JSON.stringify(params)}`,\n\t\t);\n\t}\n\n\tif (\n\t\ttypeof params.content !== 'string' ||\n\t\tparams.content.trim().length === 0\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`\"content\" must be a non-empty string, but got ${JSON.stringify(params.content)}`,\n\t\t);\n\t}\n\n\tgetCachedLut(params.content);\n};\n\nexport const lut = createEffect<LutParams, LutState>({\n\ttype: 'remotion/lut',\n\tlabel: 'lut()',\n\tdocumentationLink: 'https://www.remotion.dev/docs/effects/lut',\n\tbackend: 'webgl2',\n\tcalculateKey: (params) => getCachedLut(params.content).effectKey,\n\tsetup: setupLut,\n\tapply: ({source, width, height, params, state, flipSourceY}) => {\n\t\tapplyLut({\n\t\t\tstate,\n\t\t\tsource,","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/effects/src/lut/index.ts#L69-L105","documentation":"validateLutParams requires params.content to be a non-empty (after trim) string containing the inline text of a .cube 3D LUT file. This TypeError is thrown when content is missing, not a string (number, object, null, undefined) or only whitespace. After this check, the content is also parsed via getCachedLut, so syntactically invalid .cube content will fail later in parseCubeLut.","triggerScenarios":"`lut({})`, `lut({content: undefined})`, `lut({content: 42})`, `lut({content: '   '})`, or a typo like `lut({text: '...'})` (wrong property name yields content: undefined).","commonSituations":"Fetching a .cube file and passing the File/Blob object instead of its text; using the wrong property name; forgetting to await fs.readFile/text() so a Promise or undefined is passed; an empty file served from a URL.","solutions":["Pass the actual text contents of the .cube file as a string: lut({content: fileText}).","If loading from a URL or file, await the read: const content = await response.text(); then validate content.trim().length > 0 before calling lut().","Verify the property is named `content`, matching the LutParams type.","Type the input as LutParams so TypeScript catches missing/incorrect content at compile time."],"exampleFix":"// before\nconst effect = lut({content: await fetch(url)});\n// after\nconst content = await (await fetch(url)).text();\nif (content.trim().length === 0) throw new Error('LUT file is empty');\nconst effect = lut({content});","handlingStrategy":"validation","validationCode":"const content = typeof raw === 'string' ? raw : null;\nif (!content || content.trim().length === 0) {\n  throw new Error('LUT content must be a non-empty .cube text string');\n}\nlut({content});","typeGuard":"const hasLutContent = (p: unknown): p is {content: string} =>\n  typeof p === 'object' && p !== null &&\n  typeof (p as {content?: unknown}).content === 'string' &&\n  (p as {content: string}).content.trim().length > 0;","tryCatchPattern":"try {\n  const effect = lut({content});\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('\"content\" must be a non-empty string')) {\n    console.error('The .cube file text was empty or not a string');\n  } else throw e;\n}","preventionTips":["Await text extraction: use fs.readFile(...,'utf8') or blob.text() before passing content","Check content.trim().length > 0 before calling lut()","Name the property exactly `content` per LutParams","Type your config objects as LutParams so missing fields fail at compile time"],"tags":["validation","typescript","empty-string"],"backgroundTag":"empty-required-field","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}