{"record":{"id":"0683e4a20e8688bd","repo":"medusajs/medusa","slug":"invalid-data-0683e4","errorCode":"invalid_data","errorMessage":"Variants with IDs ${notFound.join(\", \")} do not have a price","messagePattern":"Variants with IDs (.+?) do not have a price","errorType":"validation","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/cart/steps/get-variant-price-sets.ts","lineNumber":106,"sourceCode":"      }\n    )\n  ).data\n}\n\n/**\n * Validates that all variants without a custom price have price sets and throws error for missing ones\n */\nfunction validateVariantPriceSets(\n  variantPriceSets: VariantPriceSetData[],\n  variantsWithCustomPrice: string[] = []\n): void {\n  const variantsWithCustomPriceSet = new Set(variantsWithCustomPrice)\n  const notFound = variantPriceSets\n    .filter((v) => !v.price_set?.id && !variantsWithCustomPriceSet.has(v.id))\n    .map((v) => v.id)\n\n  if (notFound.length) {\n    throw new MedusaError(\n      MedusaError.Types.INVALID_DATA,\n      `Variants with IDs ${notFound.join(\", \")} do not have a price`\n    )\n  }\n}\n\n/**\n * Unified function to process variants with context grouping optimization\n * TODO: to be discussed, support batch calculation from the pricing module. Currently\n * trying to mitigate the impact by grouping items by exact same context.\n */\nasync function processVariantPriceSets(\n  pricingService: IPricingModuleService,\n  items: PriceCalculationItem[],\n  container: MedusaContainer\n): Promise<GetVariantPriceSetsStepOutput> {\n  const result: GetVariantPriceSetsStepOutput = {}\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/cart/steps/get-variant-price-sets.ts#L88-L124","documentation":"Store API route GET /store/gift-cards/[idOrCode] requires the path parameter to be non-empty. Because Express-style routing only matches when a segment exists, hitting this means the route was invoked with an empty code (e.g. rewritten/proxied request or direct handler invocation), yielding MedusaError INVALID_ARGUMENT.","triggerScenarios":"Requests like GET /store/gift-cards/ (trailing slash, empty segment) or internal calls to the handler with idOrCode unset; also custom middleware rewriting URLs to an empty param.","commonSituations":"Misconfigured rewrites/proxies stripping the code segment; client code building the URL with an undefined variable producing '/gift-cards/'.","solutions":["Ensure the client always appends a real gift card code/id to the path","Fix proxy/rewrite rules that drop the path segment","Validate the code is non-empty client-side before making the request"],"exampleFix":"// before\nfetch(`/store/gift-cards/${code}`) // code may be ''\n// after\nif (!code) throw new Error('gift card code required')\nfetch(`/store/gift-cards/${encodeURIComponent(code)}`)","handlingStrategy":"validation","validationCode":"if (!code) throw new Error('gift card code is required')\nawait sdk.store.giftCard.retrieve(code)","typeGuard":"const isNonEmptyCode = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0","tryCatchPattern":"catch (e) { if (e.type === 'invalid_argument') return res.status(400).json({ message: 'code required' }); throw e }","preventionTips":["Disable the submit action until a code is entered","Fix proxy/rewrite rules that can produce empty path segments"],"tags":["store-api","gift-card","validation","http"],"backgroundTag":"missing-path-parameter","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}