{"record":{"id":"7fc1c4f4bc262e59","repo":"medusajs/medusa","slug":"invalid-sync-strategy-strategy-must-be-full","errorCode":null,"errorMessage":"Invalid sync strategy: ${strategy}. Must be \"full\" or \"reset\"","messagePattern":"Invalid sync strategy: (.+?)\\. Must be \"full\" or \"reset\"","errorType":"validation","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"packages/modules/index/src/services/index-module-service.ts","lineNumber":310,"sourceCode":"    )\n\n    const indexInfo = indexMetadata.map((metadata) => {\n      return {\n        id: metadata.id,\n        entity: metadata.entity,\n        status: metadata.status,\n        fields: metadata.fields.split(\",\"),\n        updated_at: metadata.updated_at,\n        last_synced_key: lastEntitySyncedKeyMap.get(metadata.entity) ?? null,\n      } satisfies IndexTypes.IndexInfo\n    })\n\n    return indexInfo\n  }\n\n  async sync({ strategy }: { strategy?: \"full\" | \"reset\" } = {}) {\n    if (strategy && ![\"full\", \"reset\"].includes(strategy)) {\n      throw new Error(\n        `Invalid sync strategy: ${strategy}. Must be \"full\" or \"reset\"`\n      )\n    }\n\n    switch (strategy) {\n      case \"full\":\n        await this.fullSync()\n        break\n      case \"reset\":\n        await this.resetSync()\n        break\n      default:\n        await this.continueSync()\n        break\n    }\n  }\n\n  /**","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/modules/index/src/services/index-module-service.ts#L292-L328","documentation":"The Index module's sync method accepts an optional strategy of 'full' or 'reset' only. Any other string throws a plain Error rejecting the call before any synchronization starts.","triggerScenarios":"Calling indexModuleService.sync({ strategy: 'incremental' }) or passing a typo'd/empty strategy string from a script or CLI.","commonSituations":"Custom sync scripts assuming strategy names not supported by the installed Medusa version; passing undefined-like strings ('') from env config.","solutions":["Use 'full' or 'reset', or call sync() with no arguments for the default","Type the parameter as 'full' | 'reset' | undefined in scripts"],"exampleFix":"// before\nawait indexService.sync({ strategy: 'incremental' })\n// after\nawait indexService.sync({ strategy: 'full' })","handlingStrategy":"type-guard","validationCode":"const strategies = ['full','reset'] as const\nif (strategy !== undefined && !strategies.includes(strategy)) throw new Error('Bad strategy')","typeGuard":"type SyncStrategy = 'full' | 'reset'\nconst isSyncStrategy = (s: string): s is SyncStrategy => s === 'full' || s === 'reset'","tryCatchPattern":null,"preventionTips":["Type script parameters as SyncStrategy | undefined","Omit the argument entirely for default behavior"],"tags":["index","sync","validation","enum"],"backgroundTag":"enum-validation-failed","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}