{"record":{"id":"ae1da4b6707d31e7","repo":"payloadcms/payload","slug":"localization-is-not-enabled-in-payload-config-ae1da4","errorCode":null,"errorMessage":"Localization is not enabled in payload config","messagePattern":"Localization is not enabled in payload config","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts","lineNumber":36,"sourceCode":"export async function migrateSqliteLocalizeStatus(args: LocalizeStatusArgs): Promise<void> {\n  const { collectionSlug, db, globalSlug, payload, req } = args\n\n  if (!collectionSlug && !globalSlug) {\n    throw new Error('Either collectionSlug or globalSlug must be provided')\n  }\n\n  if (collectionSlug && globalSlug) {\n    throw new Error('Cannot provide both collectionSlug and globalSlug')\n  }\n\n  const entitySlug = collectionSlug || globalSlug\n  const versionsTable = collectionSlug\n    ? `_${toSnakeCase(collectionSlug)}_v`\n    : `_${toSnakeCase(globalSlug)}_v`\n  const localesTable = `${versionsTable}_locales`\n\n  if (!payload.config.localization) {\n    throw new Error('Localization is not enabled in payload config')\n  }\n\n  // Check if versions are enabled on this collection/global\n  let entityConfig\n  if (collectionSlug) {\n    entityConfig = payload.config.collections.find((c) => c.slug === collectionSlug)\n  } else if (globalSlug) {\n    entityConfig = payload.config.globals.find((g) => g.slug === globalSlug)\n  }\n\n  if (!entityConfig) {\n    throw new Error(\n      `${collectionSlug ? 'Collection' : 'Global'} not found: ${collectionSlug || globalSlug}`,\n    )\n  }\n\n  payload.logger.info({\n    msg: `Starting _status localization migration for ${collectionSlug ? 'collection' : 'global'}: ${entitySlug}`,","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts#L18-L54","documentation":"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.","triggerScenarios":"Running the localize-status migration on a payload instance whose config has no `localization` key (or where it was removed after data was written).","commonSituations":"Running the migration against the wrong environment (e.g. a test fixture without localization); enabling the migration before enabling localization in config.","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."],"exampleFix":"// before\n// payload.config.ts has no localization\n// after\nexport default buildConfig({\n  localization: { locales: [{ code: 'en' }, { code: 'es' }], defaultLocale: 'en' },\n  ...,\n})","handlingStrategy":"validation","validationCode":"function assertLocalizationEnabled(payload) {\n  if (!payload.config.localization) {\n    throw new Error('Enable localization in payload config before running this migration')\n  }\n}","typeGuard":"const localizationEnabled = (p) => Boolean(p.config.localization)","tryCatchPattern":null,"preventionTips":["Gate the migration script behind a check that localization is configured.","Run the migration from the same config instance the app uses."],"tags":["migration","sqlite","localization","configuration"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}