{"record":{"id":"0a35484e4a6e67fc","repo":"payloadcms/payload","slug":"could-not-find-schemapath-in-the-fieldschemam","errorCode":null,"errorMessage":"Could not find \"${schemaPath}\" in the fieldSchemaMap","messagePattern":"Could not find \"(.+?)\" in the fieldSchemaMap","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ui/src/utilities/buildFormState.ts","lineNumber":158,"sourceCode":"    collectionSlug,\n    config: getClientConfig({\n      config,\n      i18n,\n      importMap: req.payload.importMap,\n      user: skipClientConfigAuth ? true : req.user,\n    }),\n    globalSlug,\n    i18n,\n    payload,\n    schemaMap,\n    widgetSlug,\n  })\n\n  const id = collectionSlug ? idFromArgs : undefined\n  const fieldOrEntityConfig = schemaMap.get(schemaPath)\n\n  if (!fieldOrEntityConfig) {\n    throw new Error(`Could not find \"${schemaPath}\" in the fieldSchemaMap`)\n  }\n\n  if (\n    (!('fields' in fieldOrEntityConfig) ||\n      !fieldOrEntityConfig.fields ||\n      !fieldOrEntityConfig.fields.length) &&\n    'type' in fieldOrEntityConfig &&\n    fieldOrEntityConfig.type !== 'blocks'\n  ) {\n    throw new Error(\n      `The field found in fieldSchemaMap for \"${schemaPath}\" does not contain any subfields.`,\n    )\n  }\n\n  // If there is form state but no data, deduce data from that form state, e.g. on initial load\n  // Otherwise, use the incoming data as the source of truth, e.g. on subsequent saves\n  const data = incomingData || reduceFieldsToValues(formState, true)\n","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/ui/src/utilities/buildFormState.ts#L140-L176","documentation":"A plain Error thrown by buildFormState when schemaMap.get(schemaPath) returns undefined. After resolving the schema map for the given collection/global/widget, the top-level schemaPath must resolve to an entity/field config; if it does not, the path does not match any known schema entry.","triggerScenarios":"buildFormState is called with a schemaPath that is not a key in the resolved schema map — wrong path, entity slug mismatch, field renamed/removed, or a path format that doesn't correspond to the entity root.","commonSituations":"Stale schemaPath on the client after schema changes; collectionSlug/globalSlug provided but schemaPath still points at a different entity; nested field paths passed where the root entity path is expected; schema version drift.","solutions":["Ensure schemaPath equals the collectionSlug/globalSlug/widgetSlug (or a valid sub-path) for the entity being edited.","Refresh client-side schema references after renaming entities or fields.","Log the schemaMap keys to confirm the expected root path exists.","Verify the same entity identifier is used for both the slug args and the schemaPath default."],"exampleFix":"// before\nawait buildFormState({ collectionSlug: 'media', schemaPath: 'pages' })\n\n// after — schemaPath defaults to the entity slug\nawait buildFormState({ collectionSlug: 'media' })\n// schemaPath defaults to 'media' inside buildFormState","handlingStrategy":"validation","validationCode":"function schemaPathResolves(schemaPath: string, schemaMap: Map<string, unknown>): boolean {\n  return schemaMap.has(schemaPath)\n}\n\nif (!schemaPathResolves(schemaPath, schemaMap)) {\n  throw new Error(`schemaPath '${schemaPath}' not found in schema map`)\n}","typeGuard":"function isSchemaPathNotFound(err: unknown): err is Error {\n  return err instanceof Error && /fieldSchemaMap/i.test(err.message)\n}","tryCatchPattern":"try {\n  await buildFormState({ collectionSlug, schemaPath })\n} catch (err) {\n  if (isSchemaPathNotFound(err)) {\n    // log known keys and refresh client schema references\n    return\n  }\n  throw err\n}","preventionTips":["Default schemaPath to the entity slug (collectionSlug/globalSlug) to avoid mismatches.","Regenerate client schema references after schema changes.","Log the schemaMap keys when debugging unknown paths."],"tags":["ui","form-state","schema","fields","config"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}