payloadcms/payload · error · Error
Localization is not enabled in payload config
Error message
Localization is not enabled in payload config
What it means
Precondition error from `migratePostgresLocalizeStatus`: the migration converts per-document `_status` into per-locale `_status`, which is only meaningful when Payload's `localization` config is enabled. If `payload.config.localization` is undefined, the migration cannot know the locale set and aborts.
Source
Thrown at packages/drizzle/src/postgres/predefinedMigrations/localize-status/index.ts:38
const schemaName = db.schemaName ?? 'public'
if (!collectionSlug && !globalSlug) {
throw new Error('Either collectionSlug or globalSlug must be provided')
}
if (collectionSlug && globalSlug) {
throw new Error('Cannot provide both collectionSlug and globalSlug')
}
const entitySlug = collectionSlug || globalSlug
// Convert camelCase slugs to snake_case and add version prefix/suffix
const versionsTable = collectionSlug
? `_${toSnakeCase(collectionSlug)}_v`
: `_${toSnakeCase(globalSlug!)}_v`
const localesTable = `${versionsTable}_locales`
if (!payload.config.localization) {
throw new Error('Localization is not enabled in payload config')
}
// Check if versions are enabled on this collection/global
let entityConfig
if (collectionSlug) {
const collection = payload.config.collections.find((c) => c.slug === collectionSlug)
if (collection) {
entityConfig = collection
}
} else if (globalSlug) {
const global = payload.config.globals.find((g) => g.slug === globalSlug)
if (global) {
entityConfig = global
}
}
if (!entityConfig) {
throw new Error(View on GitHub (pinned to 00c58b35c0)
Solutions
- Enable localization in `payload.config.ts` (`localization: { locales: [...], defaultLocale: '...' }`) before running this migration.
- Skip this migration entirely for environments that do not use localization.
- Confirm you actually need per-locale status; if not, do not run `migratePostgresLocalizeStatus`.
Example fix
// payload.config.ts — before: no localization key
// after:
export default buildConfig({
localization: { locales: [{ code: 'en' }, { code: 'fr' }], defaultLocale: 'en' },
// ...
}) Defensive patterns
Strategy: validation
Validate before calling
if (!payload.config.localization) {
payload.logger.info('Localization not enabled; skipping localize-status migration.')
} else {
await migratePostgresLocalizeStatus({ collectionSlug, db, payload, sql })
} Type guard
const isLocalizationEnabled = (p): boolean => Boolean(p?.config?.localization)
Try / catch
null
Prevention
- Gate predefined migrations on the config feature they require.
- Run migrations in an environment whose config matches production.
When it happens
Trigger: Running the localize-status predefined migration against a Payload config that has no `localization` block (or where it was removed/disabled), for an entity that nonetheless has versions enabled.
Common situations: Running the migration in a test/CI config without localization; migrating before enabling localization in `payload.config.ts`; environments that intentionally run without localization but pulled in the predefined migration script.
Related errors
- Either collectionSlug or globalSlug must be provided
- Cannot provide both collectionSlug and globalSlug
- ${collectionSlug ? 'Collection' : 'Global'} not found: ${col
- Migration aborted: version__status column not found in ${ver
- Localization is not enabled in payload config
AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12).
Data as JSON: /api/errors/e42887532323d975.
Report an issue: GitHub.