{"record":{"id":"9b71d839ca317898","repo":"remotion-dev/remotion","slug":"could-not-serialize-the-passed-input-props-to-json","errorCode":null,"errorMessage":"Could not serialize the passed input props to JSON: ${(err as Error).message}","messagePattern":"Could not serialize the passed input props to JSON: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/input-props-serialization.ts","lineNumber":65,"sourceCode":"\t\t\t\t\treturn value;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\ttypeof item === 'string' &&\n\t\t\t\t\tstaticBase !== null &&\n\t\t\t\t\titem.startsWith(staticBase)\n\t\t\t\t) {\n\t\t\t\t\tcustomFileUsed = true;\n\t\t\t\t\treturn `${FILE_TOKEN}${item.replace(staticBase + '/', '')}`;\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\tindent,\n\t\t);\n\t\treturn {serializedString, customDateUsed, customFileUsed, mapUsed, setUsed};\n\t} catch (err) {\n\t\tthrow new Error(\n\t\t\t'Could not serialize the passed input props to JSON: ' +\n\t\t\t\t(err as Error).message,\n\t\t);\n\t}\n};\n\nexport const deserializeJSONWithSpecialTypes = <T = Record<string, unknown>>(\n\tdata: string,\n): T => {\n\treturn JSON.parse(data, (_, value) => {\n\t\tif (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {\n\t\t\treturn new Date(value.replace(DATE_TOKEN, ''));\n\t\t}\n\n\t\tif (typeof value === 'string' && value.startsWith(FILE_TOKEN)) {\n\t\t\treturn `${window.remotion_staticBase}/${value.replace(FILE_TOKEN, '')}`;\n\t\t}\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/input-props-serialization.ts#L47-L83","documentation":"Thrown by serializeJSONWithSpecialTypes when the input props contain a value that cannot be round-tripped through its custom JSON serializer (which handles Date, File, and Map/Set but rejects everything else it cannot stringify). The underlying error message is appended so the caller can see which value failed.","triggerScenarios":"Passing input props that include functions, circular references, symbols, class instances (other than the supported Date/File/Map/Set), or DOM nodes to serializeInputProps.","commonSituations":"Putting a React element, a ref, a callback, or a non-plain object into inputProps; serializing props for --props on the CLI that were built with class instances.","solutions":["Inspect the wrapped error message to identify the offending value, then remove or replace it.","Keep inputProps serializable: use plain objects, arrays, numbers, strings, booleans, null, plus Date/File/Map/Set which Remotion supports natively.","Strip functions/refs/class instances before serializing.","Break circular references or avoid passing them as input props."],"exampleFix":"// before: input props include a function\nconst inputProps = {onClick: () => {}, title: 'Hi'};\nserializeInputProps({props: inputProps, ...}); // throws\n\n// after: pass only serializable data\nconst inputProps = {title: 'Hi'};","handlingStrategy":"validation","validationCode":"function isSerializable(v: unknown): boolean {\n  if (v === null || typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean') return true;\n  if (v instanceof Date || v instanceof File || v instanceof Map || v instanceof Set) return true;\n  if (Array.isArray(v)) return v.every(isSerializable);\n  if (typeof v === 'object') return Object.values(v as Record<string, unknown>).every(isSerializable);\n  return false; // functions, symbols, class instances, circular\n}\nif (!isSerializable(inputProps)) {\n  throw new Error('inputProps contains non-serializable values');\n}","typeGuard":null,"tryCatchPattern":"try {\n  serializeInputProps({props: inputProps, ...});\n} catch (err) {\n  // err.message names the offending value — strip it from inputProps and retry,\n  // or surface a clear validation error to the user.\n  console.error('Input props serialization failed:', (err as Error).message);\n  throw err;\n}","preventionTips":["Keep inputProps to plain JSON plus Date/File/Map/Set.","Never put functions, refs, React elements, or DOM nodes in inputProps.","Validate with a custom isSerializable walker before passing props to the CLI or renderer."],"tags":["serialization","input-props","json","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}