payloadcms/payload · error · Error

Field config not found for ${schemaPath}

Error message

Field config not found for ${schemaPath}

What it means

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.

Source

Thrown at packages/ui/src/forms/fieldSchemasToFormState/addFieldStatePromise.ts:1023

      skipConditionChecks,
      skipValidation,
      state,
    })
  } else if (field.type === 'ui') {
    if (!filter || filter(args)) {
      state[path] = fieldState
      state[path].disableFormData = true
    }
  }

  if (renderFieldFn && !fieldIsHiddenOrDisabled(field)) {
    const fieldConfig = fieldSchemaMap.get(schemaPath)

    if (!fieldConfig && !mockRSCs) {
      if (schemaPath.endsWith('.blockType')) {
        return
      } else {
        throw new Error(`Field config not found for ${schemaPath}`)
      }
    }

    if (!state[path]) {
      // Some fields (ie `Tab`) do not live in form state
      // therefore we cannot attach customComponents to them
      return
    }

    if (addedByServer) {
      state[path].addedByServer = addedByServer
    }

    renderFieldFn({
      id,
      clientFieldSchemaMap,
      collectionSlug,
      data: fullData,

View on GitHub (pinned to 00c58b35c0)

Solutions

  1. Confirm the schemaPath passed to the form-state builder corresponds to an existing field in the current schema.
  2. If rendering blocks, ensure the path uses the correct structure (blockType segments are ignored, others must resolve).
  3. Regenerate/align the client schema map with the server schema after schema changes.
  4. In tests, set mockRSCs to bypass rendering when no real schema map exists.

Example fix

// before
if (!fieldConfig && !mockRSCs) {
  if (schemaPath.endsWith('.blockType')) return
  throw new Error(`Field config not found for ${schemaPath}`)
}

// after — log available paths for diagnosis
if (!fieldConfig && !mockRSCs) {
  if (schemaPath.endsWith('.blockType')) return
  req.payload.logger.error(`Field config not found for ${schemaPath}. Known paths near it: ${[...fieldSchemaMap.keys()].filter((k) => k.startsWith(schemaPath.split('.')[0])).join(', ')}`)
  throw new Error(`Field config not found for ${schemaPath}`)
}
Defensive patterns

Strategy: type-guard

Validate before calling

function schemaPathExists(schemaPath: string, fieldSchemaMap: Map<string, unknown>): boolean {
  if (schemaPath.endsWith('.blockType')) return true
  return fieldSchemaMap.has(schemaPath)
}

if (!schemaPathExists(schemaPath, fieldSchemaMap)) {
  // skip rendering or log available paths instead of throwing
}

Type guard

function isFieldConfigNotFound(err: unknown): err is Error {
  return err instanceof Error && /Field config not found/i.test(err.message)
}

Try / catch

try {
  await buildFormState({ collectionSlug, schemaPath })
} catch (err) {
  if (isFieldConfigNotFound(err)) {
    // log known paths and skip the field rather than crashing the form
    req.payload.logger.warn({ schemaPath, known: [...fieldSchemaMap.keys()] })
    return
  }
  throw err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12). Data as JSON: /api/errors/919f50e56f3d298a. Report an issue: GitHub.