{"record":{"id":"68bbb1f01b0b2dd0","repo":"payloadcms/payload","slug":"cannot-provide-both-collectionslug-and-globalslug-68bbb1","errorCode":null,"errorMessage":"Cannot provide both collectionSlug and globalSlug","messagePattern":"Cannot provide both collectionSlug and globalSlug","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts","lineNumber":26,"sourceCode":"import { migrateMainGlobalStatus } from './migrateMainGlobal.js'\n\nexport type LocalizeStatusArgs = {\n  collectionSlug?: string\n  db: any\n  globalSlug?: string\n  payload: Payload\n  req?: any\n}\n\nexport 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)","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts#L8-L44","documentation":"Thrown by migrateSqliteLocalizeStatus when both collectionSlug and globalSlug are supplied. A single migration targets one versioned entity, and a collection and a global are distinct table families, so providing both is ambiguous and rejected.","triggerScenarios":"Calling migrateSqliteLocalizeStatus({ db, payload, collectionSlug: 'posts', globalSlug: 'settings' }).","commonSituations":"Generic helper that fills both fields 'just in case'; merging two config objects that each set one slug.","solutions":["Supply only the slug that matches the entity type you are migrating.","Split the single call into two sequential calls, one per entity."],"exampleFix":"// before\nawait migrateSqliteLocalizeStatus({ db, payload, collectionSlug: 'posts', globalSlug: 'settings' })\n// after\nawait migrateSqliteLocalizeStatus({ db, payload, collectionSlug: 'posts' })\nawait migrateSqliteLocalizeStatus({ db, payload, globalSlug: 'settings' })","handlingStrategy":"validation","validationCode":"function assertNotBothSlugs(args) {\n  if (args.collectionSlug && args.globalSlug) {\n    throw new Error('Pass only one of collectionSlug or globalSlug')\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a discriminated union type for the migration args so TS forbids both keys.","Never write generic helpers that pre-fill both slug fields."],"tags":["migration","sqlite","localization","arguments"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}