payloadcms/payload · error · Error
Localization is not enabled in payload config
Error message
Localization is not enabled in payload config
What it means
Thrown by migrateSqliteLocalizeStatus when payload.config.localization is not configured. The migration populates per-locale status rows, so it needs the configured locale codes and the localization block to exist; without it there is nothing to migrate.
Source
Thrown at packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts:36
export async function migrateSqliteLocalizeStatus(args: LocalizeStatusArgs): Promise<void> {
const { collectionSlug, db, globalSlug, payload, req } = args
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
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) {
entityConfig = payload.config.collections.find((c) => c.slug === collectionSlug)
} else if (globalSlug) {
entityConfig = payload.config.globals.find((g) => g.slug === globalSlug)
}
if (!entityConfig) {
throw new Error(
`${collectionSlug ? 'Collection' : 'Global'} not found: ${collectionSlug || globalSlug}`,
)
}
payload.logger.info({
msg: `Starting _status localization migration for ${collectionSlug ? 'collection' : 'global'}: ${entitySlug}`,View on GitHub (pinned to 00c58b35c0)
Solutions
- Enable localization in payload.config (set config.localization with localeCodes) before running the migration.
- Point the migration at an environment whose config already has localization enabled.
- If localization was intentionally removed, skip this migration entirely — it does not apply.
Example fix
// before
// payload.config.ts has no localization
// after
export default buildConfig({
localization: { locales: [{ code: 'en' }, { code: 'es' }], defaultLocale: 'en' },
...,
}) Defensive patterns
Strategy: validation
Validate before calling
function assertLocalizationEnabled(payload) {
if (!payload.config.localization) {
throw new Error('Enable localization in payload config before running this migration')
}
} Type guard
const localizationEnabled = (p) => Boolean(p.config.localization)
Prevention
- Gate the migration script behind a check that localization is configured.
- Run the migration from the same config instance the app uses.
When it happens
Trigger: Running the localize-status migration on a payload instance whose config has no `localization` key (or where it was removed after data was written).
Common situations: Running the migration against the wrong environment (e.g. a test fixture without localization); enabling the migration before enabling localization in config.
Related errors
- ${collectionSlug ? 'Collection' : 'Global'} not found: ${col
- Either collectionSlug or globalSlug must be provided
- Cannot provide both collectionSlug and globalSlug
- Migration aborted: version__status column not found in ${ver
- Either collectionSlug or globalSlug must be provided
AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12).
Data as JSON: /api/errors/ae1da4b6707d31e7.
Report an issue: GitHub.