{"record":{"id":"ab56a7728a4ac4ca","repo":"payloadcms/payload","slug":"collectionslug-collection-global-not-fo","errorCode":null,"errorMessage":"${collectionSlug ? 'Collection' : 'Global'} not found: ${collectionSlug || globalSlug}","messagePattern":"(.+?) not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/db-mongodb/src/predefinedMigrations/migrateLocalizeStatus.ts","lineNumber":111,"sourceCode":"    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    const collection = payload.config.collections.find((c) => c.slug === collectionSlug)\n    if (collection) {\n      entityConfig = collection\n    }\n  } else if (globalSlug) {\n    const global = payload.config.globals.find((g) => g.slug === globalSlug)\n    if (global) {\n      entityConfig = global\n    }\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}`,\n  })\n\n  // Check if versions are enabled in config (skip if not)\n  if (!entityConfig.versions) {\n    payload.logger.info({\n      msg: `Skipping migration for ${collectionSlug ? 'collection' : 'global'}: ${entitySlug} - versions not enabled`,\n    })\n    return\n  }\n\n  // Get MongoDB connection\n  const connection = (payload.db as any).connection","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/db-mongodb/src/predefinedMigrations/migrateLocalizeStatus.ts#L93-L129","documentation":"localizeStatus looks up the provided slug in payload.config.collections (for collectionSlug) or payload.config.globals (for globalSlug). If neither list contains a matching slug, it throws with the entity type and slug inlined.","triggerScenarios":"Calling localizeStatus({ collectionSlug: 'x' }) when no collection with slug 'x' exists in config (renamed/removed slug, typo), or { globalSlug: 'y' } when no such global is configured.","commonSituations":"Slug was renamed and the migration caller still uses the old slug; typo in the slug; calling localizeStatus for an entity not present in the current config; running the migration in an environment with a trimmed config.","solutions":["Confirm the slug exists in payload.config.collections (or globals) and matches exactly (case-sensitive).","Update your migration caller to use the current slug after a rename.","Use the migrateLocalizeStatus() orchestrator which derives slugs from config and never passes a missing one.","Log payload.config.collections.map(c => c.slug) before calling to verify."],"exampleFix":"// before — slug renamed from 'posts' to 'articles'\nawait localizeStatus({ collectionSlug: 'posts', payload, req })\n\n// after\nawait localizeStatus({ collectionSlug: 'articles', payload, req })","handlingStrategy":"validation","validationCode":"function assertEntityExists(args: { collectionSlug?: string; globalSlug?: string; payload: { config: { collections: { slug: string }[]; globals: { slug: string }[] } } }) {\n  const { collectionSlug, globalSlug, payload } = args\n  const exists = collectionSlug\n    ? payload.config.collections.some((c) => c.slug === collectionSlug)\n    : payload.config.globals.some((g) => g.slug === globalSlug)\n  if (!exists) throw new Error(`Entity not found: ${collectionSlug ?? globalSlug}`)\n}","typeGuard":"function entityExists(slug: string, payload: { config: { collections: { slug: string }[]; globals: { slug: string }[] } }, kind: 'collection' | 'global'): boolean {\n  return kind === 'collection'\n    ? payload.config.collections.some((c) => c.slug === slug)\n    : payload.config.globals.some((g) => g.slug === slug)\n}","tryCatchPattern":null,"preventionTips":["Use the migrateLocalizeStatus() orchestrator which only iterates existing entities.","Update migration callers after renaming a slug.","Verify slug spelling against config before invoking."],"tags":["db-mongodb","migration","validation","localization","config"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}