{"record":{"id":"760b41557623a76e","repo":"remotion-dev/remotion","slug":"value-must-be-a-string-but-is-json-stringify-va","errorCode":null,"errorMessage":"Value must be a string, but is ${JSON.stringify(value)}","messagePattern":"Value must be a string, but is (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/find-props-to-delete.ts","lineNumber":19,"sourceCode":"import type {InteractivitySchema} from './internals';\n\nexport const findPropsToDelete = ({\n\tschema,\n\tkey,\n\tvalue,\n}: {\n\tschema: InteractivitySchema;\n\tkey: string;\n\tvalue: unknown;\n}) => {\n\tconst fieldSchema = schema[key];\n\n\tif (!fieldSchema) {\n\t\tthrow new Error('Key ' + JSON.stringify(key) + ' not found in schema');\n\t}\n\n\tif (typeof value !== 'string') {\n\t\tthrow new Error('Value must be a string, but is ' + JSON.stringify(value));\n\t}\n\n\tif (fieldSchema.type !== 'enum') {\n\t\tthrow new Error('Key ' + JSON.stringify(key) + ' is not an enum');\n\t}\n\n\tconst currentVariant = fieldSchema.variants[value as string];\n\tif (!currentVariant) {\n\t\tthrow new Error(\n\t\t\t'Value for ' +\n\t\t\t\tJSON.stringify(key) +\n\t\t\t\t' must be one of ' +\n\t\t\t\tObject.keys(fieldSchema.variants)\n\t\t\t\t\t.map((v) => JSON.stringify(v))\n\t\t\t\t\t.join(', ') +\n\t\t\t\t', got ' +\n\t\t\t\tJSON.stringify(value),\n\t\t);","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/find-props-to-delete.ts#L1-L37","documentation":"Thrown by findPropsToDelete when the `value` argument is not a string. Interactive enum variants are keyed by strings, so the function refuses non-string values (numbers, objects, undefined) before looking up the variant.","triggerScenarios":"Calling findPropsToDelete with value being a number, boolean, null, undefined, or object — e.g. passing a raw numeric variant id instead of its string key.","commonSituations":"Loosely-typed callers (plain JS, deserialized JSON with coerced types) feeding a number where a variant string is expected; off-by-one in destructuring that yields undefined.","solutions":["Coerce or select the string variant key before calling: pass `String(value)` only if you are certain it names a variant, otherwise map the value to its variant name.","Add a runtime check `if (typeof value !== 'string') return;` at the caller.","Inspect the call site for undefined caused by bad destructuring or missing map keys.","Type the caller's value as string so TypeScript flags the misuse at compile time."],"exampleFix":"// before\nfindPropsToDelete({schema, key: 'size', value: 2});\n\n// after\nfindPropsToDelete({schema, key: 'size', value: 'large'});","handlingStrategy":"type-guard","validationCode":"if (typeof value !== 'string') {\n  throw new TypeError(`value must be a string variant, got ${typeof value}`);\n}\nfindPropsToDelete({schema, key, value});","typeGuard":"function isStringVariant(value: unknown): value is string {\n  return typeof value === 'string';\n}","tryCatchPattern":null,"preventionTips":["Type the value as string at the caller so TypeScript catches misuse.","Validate deserialized input before forwarding it to schema APIs.","Watch for undefined from failed destructuring."],"tags":["interactivity","schema","validation","types"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}