{"record":{"id":"04e530372f5d4141","repo":"supabase/supabase","slug":"schema-error-schema-shape-key-is-undefined","errorCode":null,"errorMessage":"Schema error: schema.shape['${key}'] is undefined. Check schema definition.","messagePattern":"Schema error: schema\\.shape\\['(.+?)'\\] is undefined\\. Check schema definition\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/ui-library/registry/default/platform/platform-kit-nextjs/components/dynamic-form.tsx","lineNumber":90,"sourceCode":"  }\n  return currentSchema\n}\n\nexport function DynamicForm<T extends z.ZodRawShape = z.ZodRawShape>({\n  schema,\n  onSubmit,\n  isLoading = false,\n  initialValues,\n  labels,\n  columnInfo,\n}: DynamicFormProps<T>) {\n  const isInitializingRef = useRef(true)\n\n  const defaultValues = Object.keys(schema.shape).reduce(\n    (acc, key) => {\n      const originalFieldSchema = schema.shape[key]\n      if (typeof originalFieldSchema === 'undefined') {\n        throw new Error(\n          `Schema error: schema.shape['${key}'] is undefined. Check schema definition.`\n        )\n      }\n\n      // Support both old (typeName) and new (type) Zod formats\n      const getTypeName = (def: Record<string, any>) => def.typeName || def.type\n\n      if (\n        getTypeName(getZodDef(originalFieldSchema)) === 'ZodDefault' ||\n        getTypeName(getZodDef(originalFieldSchema)) === 'default'\n      ) {\n        acc[key] = getZodDef(originalFieldSchema).defaultValue()\n        return acc\n      }\n\n      const baseType = unwrapZodType(originalFieldSchema)\n\n      switch (getTypeName(getZodDef(baseType))) {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/supabase/supabase/blob/beee91b9c2228dd57302dec75c733baaa84ab543/apps/ui-library/registry/default/platform/platform-kit-nextjs/components/dynamic-form.tsx#L72-L108","documentation":"Error \"Schema error: schema.shape['${key}'] is undefined. Check schema definition.\" thrown in supabase/supabase.","triggerScenarios":"Thrown at apps/ui-library/registry/default/platform/platform-kit-nextjs/components/dynamic-form.tsx:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"beee91b9c2228dd57302dec75c733baaa84ab543","analyzedAt":"2026-08-12T06:51:48.935Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}