{"record":{"id":"aa538a8bc9bb5dd6","repo":"medusajs/medusa","slug":"application-method-allocation-once-is-not-compat","errorCode":null,"errorMessage":"application_method.allocation 'once' is not compatible with target_type 'order'","messagePattern":"application_method\\.allocation 'once' is not compatible with target_type 'order'","errorType":"validation","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/modules/promotion/src/utils/validations/application-method.ts","lineNumber":168,"sourceCode":"\n  if (\n    allocation &&\n    allowedAllocationForQuantity.includes(allocation) &&\n    !isDefined(maxQuantity)\n  ) {\n    throw new MedusaError(\n      MedusaError.Types.INVALID_DATA,\n      `application_method.max_quantity is required when application_method.allocation is '${allowedAllocationForQuantity.join(\n        \" OR \"\n      )}'`\n    )\n  }\n\n  if (\n    allocation === ApplicationMethodAllocation.ONCE &&\n    targetType === ApplicationMethodTargetType.ORDER\n  ) {\n    throw new MedusaError(\n      MedusaError.Types.INVALID_DATA,\n      `application_method.allocation 'once' is not compatible with target_type 'order'`\n    )\n  }\n}\n","sourceCodeStart":150,"sourceCodeEnd":174,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/modules/promotion/src/utils/validations/application-method.ts#L150-L174","documentation":"Allocation 'once' is incompatible with target_type 'order'. An order-level application method applies to the whole order by definition, so 'once' (single application) is rejected with INVALID_DATA; use allocation 'across' for order target types.","triggerScenarios":"Creating a promotion with target_type 'order' and allocation 'once' — commonly an order-level fixed discount payload that copied 'once' from another promo.","commonSituations":"Misreading 'once' as 'one order', form defaults, integrations applying the same allocation to all target types.","solutions":["Use allocation 'across' with target_type 'order'","Omit/choose allocation appropriate to the target type (order-level methods typically use 'across')","Validate the allocation/target_type pair in the form logic"],"exampleFix":"// before\napplication_method: { type: \"fixed\", value: 20, target_type: \"order\", allocation: \"once\" }\n\n// after\napplication_method: { type: \"fixed\", value: 20, target_type: \"order\", allocation: \"across\" }","handlingStrategy":"validation","validationCode":"if (targetType === ApplicationMethodTargetType.ORDER && allocation === ApplicationMethodAllocation.ONCE) {\n  allocation = ApplicationMethodAllocation.ACROSS\n}","typeGuard":"const isAllocationTargetCompatible = (allocation: string | undefined, targetType: string | undefined): boolean => !(allocation === \"once\" && targetType === \"order\")","tryCatchPattern":"try { await createPromotions(...) } catch (e) { if (e.type === MedusaError.Types.INVALID_DATA && /'once' is not compatible with target_type 'order'/.test(e.message)) { /* switch to across and resubmit */ } throw e }","preventionTips":["Use 'across' for order-level application methods","Reserve 'once' for non-order target types","Validate allocation/target pairs in the form"],"tags":["promotion","application-method","allocation","validation","medusa"],"backgroundTag":"mutually-exclusive-fields","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}