medusajs/medusa · error · MedusaError
application_method.type should be one of ${allTypes.join(",
Error message
application_method.type should be one of ${allTypes.join(", ")} What it means
application_method.type must be one of the ApplicationMethodType values (fixed, percentage, buyget... per the installed version). Any other string throws INVALID_DATA listing the valid types.
Source
Thrown at packages/modules/promotion/src/utils/validations/application-method.ts:118
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`application_method.max_quantity is not allowed to be set for allocation (${ApplicationMethodAllocation.ACROSS})`
)
}
if (!allTargetTypes.includes(targetType)) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`application_method.target_type should be one of ${allTargetTypes.join(
", "
)}`
)
}
const allTypes: string[] = Object.values(ApplicationMethodType)
if (!allTypes.includes(applicationMethodType)) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`application_method.type should be one of ${allTypes.join(", ")}`
)
}
if (
allowedAllocationTargetTypes.includes(targetType) &&
!allowedAllocationTypes.includes(allocation || "")
) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
`application_method.allocation should be either '${allowedAllocationTypes.join(
" OR "
)}' when application_method.target_type is either '${allowedAllocationTargetTypes.join(
" OR "
)}'`
)
}View on GitHub (pinned to 5e06e544a2)
Solutions
- Set type to a valid ApplicationMethodType ('fixed', 'percentage', 'buyget' as available)
- After upgrading Medusa, re-check the enum — re-export or inline the constants from @medusajs/utils rather than hardcoding strings
- Add a zod/enum check in the API layer
Example fix
// before
application_method: { type: "percent", value: 10, ... }
// after
import { ApplicationMethodType } from "@medusajs/utils"
application_method: { type: ApplicationMethodType.PERCENTAGE, value: 10, ... } Defensive patterns
Strategy: type-guard
Validate before calling
const allTypes = Object.values(ApplicationMethodType)
if (!allTypes.includes(am.type)) throw new Error(`invalid application_method.type: ${am.type}`) Type guard
import { ApplicationMethodType } from "@medusajs/utils"
const isValidApplicationMethodType = (t: string): t is ApplicationMethodType =>
(Object.values(ApplicationMethodType) as string[]).includes(t) Try / catch
try { await createPromotions(...) } catch (e) { if (e.type === MedusaError.Types.INVALID_DATA && /application_method.type should be one of/.test(e.message)) { /* map legacy value to current enum and retry */ } throw e } Prevention
- Import enums from the package instead of hardcoding
- Recheck enums after Medusa upgrades
- Add zod enum validation at the API boundary
When it happens
Trigger: Passing application_method.type 'flat', 'percent', 'absolute', or an outdated value no longer in the enum.
Common situations: Version upgrades that renamed/removed enum members, integrations written from memory instead of the types package, case mistakes ('Percentage').
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- application_method.target_type should be one of ${allTargetT
- Application Method value should be a percentage number betwe
- application_method.max_quantity is not allowed to be set for
- application_method.allocation should be either '${allowedAll
- application_method.allocation should be one of ${allAllocati
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/1f8d7d61c49de82f.
Report an issue: GitHub.