{"record":{"id":"919f50e56f3d298a","repo":"payloadcms/payload","slug":"field-config-not-found-for-schemapath","errorCode":null,"errorMessage":"Field config not found for ${schemaPath}","messagePattern":"Field config not found for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ui/src/forms/fieldSchemasToFormState/addFieldStatePromise.ts","lineNumber":1023,"sourceCode":"      skipConditionChecks,\n      skipValidation,\n      state,\n    })\n  } else if (field.type === 'ui') {\n    if (!filter || filter(args)) {\n      state[path] = fieldState\n      state[path].disableFormData = true\n    }\n  }\n\n  if (renderFieldFn && !fieldIsHiddenOrDisabled(field)) {\n    const fieldConfig = fieldSchemaMap.get(schemaPath)\n\n    if (!fieldConfig && !mockRSCs) {\n      if (schemaPath.endsWith('.blockType')) {\n        return\n      } else {\n        throw new Error(`Field config not found for ${schemaPath}`)\n      }\n    }\n\n    if (!state[path]) {\n      // Some fields (ie `Tab`) do not live in form state\n      // therefore we cannot attach customComponents to them\n      return\n    }\n\n    if (addedByServer) {\n      state[path].addedByServer = addedByServer\n    }\n\n    renderFieldFn({\n      id,\n      clientFieldSchemaMap,\n      collectionSlug,\n      data: fullData,","sourceCodeStart":1005,"sourceCodeEnd":1041,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/ui/src/forms/fieldSchemasToFormState/addFieldStatePromise.ts#L1005-L1041","documentation":"A plain Error thrown in addFieldStatePromise during form-state building when renderFieldFn is set, the field is visible/enabled, but fieldSchemaMap.get(schemaPath) returns undefined (and mockRSCs is falsy, and schemaPath does not end in '.blockType'). It indicates the server-side field schema map does not contain an entry for the path being rendered.","triggerScenarios":"Form-state construction requests rendering a field whose schemaPath is not present in the fieldSchemaMap — typically a path mismatch, a field that was renamed/removed, or an RSC/client schema-map divergence. The '.blockType' suffix is explicitly exempted because blockType sub-paths are not real field entries.","commonSituations":"Custom fields referenced by a path that no longer exists; blocks where the path includes a non-blockType segment the map doesn't track; version drift between the generated client schema map and the server schema; tests running without mockRSCs that would otherwise short-circuit this path.","solutions":["Confirm the schemaPath passed to the form-state builder corresponds to an existing field in the current schema.","If rendering blocks, ensure the path uses the correct structure (blockType segments are ignored, others must resolve).","Regenerate/align the client schema map with the server schema after schema changes.","In tests, set mockRSCs to bypass rendering when no real schema map exists."],"exampleFix":"// before\nif (!fieldConfig && !mockRSCs) {\n  if (schemaPath.endsWith('.blockType')) return\n  throw new Error(`Field config not found for ${schemaPath}`)\n}\n\n// after — log available paths for diagnosis\nif (!fieldConfig && !mockRSCs) {\n  if (schemaPath.endsWith('.blockType')) return\n  req.payload.logger.error(`Field config not found for ${schemaPath}. Known paths near it: ${[...fieldSchemaMap.keys()].filter((k) => k.startsWith(schemaPath.split('.')[0])).join(', ')}`)\n  throw new Error(`Field config not found for ${schemaPath}`)\n}","handlingStrategy":"type-guard","validationCode":"function schemaPathExists(schemaPath: string, fieldSchemaMap: Map<string, unknown>): boolean {\n  if (schemaPath.endsWith('.blockType')) return true\n  return fieldSchemaMap.has(schemaPath)\n}\n\nif (!schemaPathExists(schemaPath, fieldSchemaMap)) {\n  // skip rendering or log available paths instead of throwing\n}","typeGuard":"function isFieldConfigNotFound(err: unknown): err is Error {\n  return err instanceof Error && /Field config not found/i.test(err.message)\n}","tryCatchPattern":"try {\n  await buildFormState({ collectionSlug, schemaPath })\n} catch (err) {\n  if (isFieldConfigNotFound(err)) {\n    // log known paths and skip the field rather than crashing the form\n    req.payload.logger.warn({ schemaPath, known: [...fieldSchemaMap.keys()] })\n    return\n  }\n  throw err\n}","preventionTips":["Regenerate the client schema map after schema changes so paths stay aligned.","Use mockRSCs in tests to avoid hitting this guard without a real schema map.","Validate dynamic schemaPaths against the map before requesting a render."],"tags":["ui","form-state","fields","schema","render"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}