{"record":{"id":"40eb8da6914c62b6","repo":"remotion-dev/remotion","slug":"a-value-which-is-not-a-zod-schema-was-passed-to-s","errorCode":null,"errorMessage":"A value which is not a Zod schema was passed to `schema`","messagePattern":"A value which is not a Zod schema was passed to `schema`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/RenderModal/SchemaEditor/infer-zod-schema-from-value.ts","lineNumber":129,"sourceCode":"\texplicitSchema,\n\tdefaultProps,\n\tz,\n\tzodTypes,\n}: {\n\treadonly explicitSchema: unknown;\n\treadonly defaultProps: Record<string, unknown>;\n\treadonly z: ZodNamespace | null;\n\treadonly zodTypes: ZodTypesType | null;\n}): ResolvedCompositionSchema {\n\tif (!z) {\n\t\treturn 'no-zod';\n\t}\n\n\tif (explicitSchema) {\n\t\tif (\n\t\t\ttypeof (explicitSchema as {safeParse?: unknown}).safeParse !== 'function'\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t'A value which is not a Zod schema was passed to `schema`',\n\t\t\t);\n\t\t}\n\n\t\treturn explicitSchema as AnyZodSchema;\n\t}\n\n\tif (Object.keys(defaultProps).length === 0) {\n\t\treturn 'no-schema';\n\t}\n\n\treturn inferZodSchemaFromValue({\n\t\tvalue: defaultProps,\n\t\tz,\n\t\tzodTypes,\n\t\tpath: [],\n\t});\n}","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/studio/src/components/RenderModal/SchemaEditor/infer-zod-schema-from-value.ts#L111-L147","documentation":"When the Render Modal's schema editor resolves a composition's `schema` prop, `resolveCompositionSchema()` accepts any explicit value but verifies it duck-types as Zod (`safeParse` must be a function, packages/studio/src/components/RenderModal/SchemaEditor/infer-zod-schema-from-value.ts:127). If you passed something truthy that is not a Zod schema instance — a plain object, a schema builder like `z.object` un-applied, or a Zod namespace — Studio throws this error instead of rendering the props editor.","triggerScenarios":"A `<Composition schema={...}>` (or `<Still>`) whose value is truthy but has no `safeParse` method: e.g. `schema={{title: z.string()}}` (plain object of fields), `schema={z.object}` (the factory, not its result), or `schema={zodNamespace}`. The throw happens when Studio opens/renders the schema editor for that composition.","commonSituations":"Confusing the shape object with a wrapped schema; passing JSON Schema instead of Zod; importing two different schema libraries or a custom `z` namespace whose values are not Zod types; refactors that accidentally pass `defaultProps`-style objects as `schema`.","solutions":["Pass an actual Zod schema: wrap fields with `z.object({...})` and pass the result (`schema={z.object({title: z.string()})}`).","Sanity-check before assigning: `typeof schema.safeParse === 'function'` must hold.","If using a custom/aliased zod instance or version (zod/v4, zod-mini), make sure the value passed is a schema instance from that same library, not a config object or namespace."],"exampleFix":"// before\n<Composition schema={{title: z.string(), count: z.number()}} ... />\n\n// after\n<Composition schema={z.object({title: z.string(), count: z.number()})} ... />","handlingStrategy":"type-guard","validationCode":"import {z} from 'zod';\n\nconst schemaValue = z.object({title: z.string()});\nif (typeof schemaValue.safeParse !== 'function') {\n  throw new TypeError('schema must be a Zod schema instance');\n}\n// safe to pass to <Composition schema={schemaValue}>","typeGuard":"import type {ZodType} from 'zod';\n\nconst isZodSchema = (value: unknown): value is ZodType =>\n  typeof value === 'object' &&\n  value !== null &&\n  typeof (value as {safeParse?: unknown}).safeParse === 'function';","tryCatchPattern":null,"preventionTips":["Always pass the result of a Zod builder (`z.object({...})`), never the factory itself (`z.object`) or a plain fields object.","If you centralize schemas, export Zod instances and verify them with `isZodSchema()` in one place before handing them to `<Composition>`/`<Still>`.","Keep a single Zod dependency/version in the project to avoid mixing schema instances from different builds."],"tags":["zod","schema","composition","props-editor","typescript"],"backgroundTag":"invalid-schema-argument","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}