{"record":{"id":"ed9146d840e073db","repo":"payloadcms/payload","slug":"either-collectionslug-or-globalslug-must-be-provid-ed9146","errorCode":null,"errorMessage":"Either collectionSlug or globalSlug must be provided","messagePattern":"Either collectionSlug or globalSlug must be provided","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts","lineNumber":22,"sourceCode":"import { calculateVersionLocaleStatuses } from 'payload/migrations'\nimport toSnakeCase from 'to-snake-case'\n\nimport { migrateMainCollectionStatus } from './migrateMainCollection.js'\nimport { 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","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts#L4-L40","documentation":"Thrown by migrateSqliteLocalizeStatus when neither collectionSlug nor globalSlug is supplied. The migration operates on one versioned entity at a time, so exactly one target slug is required.","triggerScenarios":"Calling migrateSqliteLocalizeStatus({ db, payload }) with both collectionSlug and globalSlug omitted.","commonSituations":"Destructuring args incompletely; calling the migration in a loop and passing undefined for the slug variable on some iterations.","solutions":["Pass exactly one of collectionSlug (for a collection) or globalSlug (for a global) to the call.","If scripting over many entities, guard the call site: only invoke when the slug is truthy."],"exampleFix":"// before\nawait migrateSqliteLocalizeStatus({ db, payload })\n// after\nawait migrateSqliteLocalizeStatus({ db, payload, collectionSlug: 'posts' })","handlingStrategy":"validation","validationCode":"function assertOneEntitySlug(args) {\n  if (!args.collectionSlug && !args.globalSlug) {\n    throw new Error('Pass either collectionSlug or globalSlug')\n  }\n}","typeGuard":"const hasEitherSlug = (a) => Boolean(a.collectionSlug) || Boolean(a.globalSlug)","tryCatchPattern":null,"preventionTips":["When looping over entities, skip iterations where the resolved slug is falsy.","Keep a single helper that asserts slug preconditions before calling the migration."],"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"}