{"record":{"id":"759da7d192fb753f","repo":"remotion-dev/remotion","slug":"name-must-be-an-object-but-you-passed-a-valu","errorCode":null,"errorMessage":"\"${name}\" must be an object, but you passed a value of type ${typeof defaultProps}","messagePattern":"\"(.+?)\" must be an object, but you passed a value of type (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-default-props.ts","lineNumber":11,"sourceCode":"export const validateDefaultAndInputProps = (\n\tdefaultProps: unknown,\n\tname: 'defaultProps' | 'inputProps',\n\tcompositionId: string | null,\n) => {\n\tif (!defaultProps) {\n\t\treturn;\n\t}\n\n\tif (typeof defaultProps !== 'object') {\n\t\tthrow new Error(\n\t\t\t`\"${name}\" must be an object, but you passed a value of type ${typeof defaultProps}`,\n\t\t);\n\t}\n\n\tif (Array.isArray(defaultProps)) {\n\t\tthrow new Error(\n\t\t\t`\"${name}\" must be an object, an array was passed ${\n\t\t\t\tcompositionId ? `for composition \"${compositionId}\"` : ''\n\t\t\t}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-default-props.ts#L1-L24","documentation":"`validateDefaultAndInputProps` requires that `defaultProps`/`inputProps` passed to a `<Composition>` be a plain object. A falsy value (null/undefined/0/'') is allowed (treated as 'none'), but any other non-object primitive (string, number, boolean, symbol, bigint) throws. This runs during `<Composition>` registration.","triggerScenarios":"Passing `defaultProps` or `inputProps` as a primitive — e.g. `defaultProps={42}`, `defaultProps=\"hello\"`, `defaultProps={true}` — to a `<Composition>`.","commonSituations":"Forwarding a single scalar config value directly as props instead of wrapping it; deserializing a JSON string and passing the resulting primitive; misreading the prop as taking a single value rather than an object bag.","solutions":["Wrap scalars in an object: `defaultProps={{count: 42}}`.","If you have no default props, omit the prop (or pass nothing) instead of a primitive.","Parse config into an object before assigning."],"exampleFix":"// before\n<Composition defaultProps={42} ... />\n// after\n<Composition defaultProps={{count: 42}} ... />","handlingStrategy":"validation","validationCode":"function assertPropsObject(p, name) {\n  if (p && typeof p !== 'object') {\n    throw new Error(name + ' must be an object, got ' + typeof p);\n  }\n}","typeGuard":"const isPropsObject = (p) => p == null || (typeof p === 'object' && !Array.isArray(p));","tryCatchPattern":null,"preventionTips":["Always model props as an object bag, even for a single value.","Run `typeof x === 'object' && !Array.isArray(x)` on dynamic inputs."],"tags":["validation","composition","default-props","input-props","type"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}