{"record":{"id":"4005cb3a9c321f11","repo":"strapi/strapi","slug":"invalid-strategy-strategy","errorCode":null,"errorMessage":"Invalid strategy ${strategy}","messagePattern":"Invalid strategy (.+?)","errorType":"validation","errorClass":"ProviderValidationError","httpStatus":null,"severity":"error","filePath":"packages/core/data-transfer/src/strapi/providers/local-destination/index.ts","lineNumber":344,"sourceCode":"    return createAssetsDestinationWritable({\n      strapi: this.strapi,\n      transaction: this.transaction!,\n      resolveUploadFileId: (metadata) => fileEntitiesMapper?.[metadata.id],\n      restoreMediaEntitiesContent: this.#isContentTypeIncluded('plugin::upload.file'),\n      removeAssetsBackup: this.#removeAssetsBackup.bind(this),\n    });\n  }\n\n  async createConfigurationWriteStream(): Promise<Writable> {\n    assertValidStrapi(this.strapi, 'Not able to stream Configurations');\n    this.#reportInfo('creating configuration write stream');\n    const { strategy } = this.options;\n\n    if (strategy === 'restore') {\n      return restore.createConfigurationWriteStream(this.strapi, this.transaction);\n    }\n\n    throw new ProviderValidationError(`Invalid strategy ${strategy}`, {\n      check: 'strategy',\n      strategy,\n      validStrategies: VALID_CONFLICT_STRATEGIES,\n    });\n  }\n\n  async createLinksWriteStream(): Promise<Writable> {\n    this.#reportInfo('creating links write stream');\n    if (!this.strapi) {\n      throw new Error('Not able to stream links. Strapi instance not found');\n    }\n\n    const { strategy } = this.options;\n    const mapID = (uid: string, id: number): number | undefined => this.#entitiesMapper[uid]?.[id];\n\n    if (strategy === 'restore') {\n      return restore.createLinksWriteStream(mapID, this.strapi, this.transaction, this.onWarning);\n    }","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/strapi/strapi/blob/4a4101264d7098754df36e85fa629fd2f2349d8c/packages/core/data-transfer/src/strapi/providers/local-destination/index.ts#L326-L362","documentation":"Thrown by createConfigurationWriteStream() if options.strategy is not 'restore'. Like error 265, this is a defensive fallback after the `if (strategy === 'restore')` check. It should be unreachable if bootstrap() validated options successfully, and indicates options.strategy was mutated or bootstrap was skipped. It is a ProviderValidationError.","triggerScenarios":"Calling createConfigurationWriteStream() without calling bootstrap(), or mutating provider.options.strategy to a non-'restore' value after bootstrap validation.","commonSituations":"A custom pipeline that skips bootstrap(). External code modifying options.strategy between phases. Test harnesses calling streaming methods in isolation.","solutions":["Call and await bootstrap() before createConfigurationWriteStream().","Do not mutate provider.options.strategy after construction.","Set strategy to 'restore' before creating the provider."],"exampleFix":"// before\nawait provider.bootstrap(); // not called\nprovider.createConfigurationWriteStream(); // throws\n// after\nawait provider.bootstrap();\nprovider.createConfigurationWriteStream();","handlingStrategy":"validation","validationCode":"import { VALID_CONFLICT_STRATEGIES } from '@strapi/data-transfer/strapi/providers/local-destination';\n\nfunction assertStrategyForConfig(strategy: string): void {\n  if (!VALID_CONFLICT_STRATEGIES.includes(strategy as any)) {\n    throw new Error(`Cannot create configuration stream: invalid strategy \"${strategy}\"`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  provider.createConfigurationWriteStream();\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid strategy')) {\n    console.error('Ensure bootstrap() was called and strategy was not mutated.');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always call bootstrap() before createConfigurationWriteStream().","Never mutate provider.options.strategy after construction.","Follow the full provider lifecycle in order."],"tags":["data-transfer","validation","lifecycle","restore","defensive-guard"],"backgroundTag":null,"analyzedSha":"4a4101264d7098754df36e85fa629fd2f2349d8c","analyzedAt":"2026-08-12T12:47:50.760Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}