medusajs/medusa · error · MedusaError

Product with id: ${req.params.id} was not found

Error message

Product with id: ${req.params.id} was not found

What it means

Thrown by GET /store/products/:id when the product query (with requested fields, locale, and store filters) returns no product. The id may be invalid, the product unpublished, or the product filtered out of the store scope. Returns 404 NOT_FOUND.

Source

Thrown at packages/medusa/src/api/store/products/[id]/route.ts:64

  }

  const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)

  const { data: products } = await query.graph(
    {
      entity: "product",
      filters,
      context,
      fields: req.queryConfig.fields,
    },
    {
      locale: req.locale,
    }
  )
  const product = products[0]

  if (!product) {
    throw new MedusaError(
      MedusaError.Types.NOT_FOUND,
      `Product with id: ${req.params.id} was not found`
    )
  }

  if (withInventoryQuantity) {
    await wrapVariantsWithInventoryQuantityForSalesChannel(
      req,
      product.variants || []
    )
  }

  if (includesCategoriesField) {
    filterOutInternalProductCategories([product])
  }

  await wrapProductsWithTaxPrices(req, [product])
  res.json({ product })

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Check the product exists and is published in Admin (status = published)
  2. Ensure the product is added to the sales channel and regions your storefront uses
  3. Implement 404 handling that shows a product-unavailable page and suggests alternatives

Example fix

// before
const { product } = await sdk.store.product.retrieve('prod_123') // 404 if unpublished

// after
try {
  const { product } = await sdk.store.product.retrieve('prod_123')
} catch (e) {
  if (e.type === 'not_found') notFound() // render 404 page
}
Defensive patterns

Strategy: try-catch

Validate before calling

const { products } = await sdk.store.product.list({ id: [productId] })
if (!products.length) notFound()

Try / catch

try {
  const { product } = await sdk.store.product.retrieve(id)
} catch (e: any) {
  if (e.type === 'not_found') notFound()
  throw e
}

Prevention

When it happens

Trigger: Requesting /store/products/prod_... for a deleted product, an unpublished/draft product, or a product excluded by store filters (sales channel, region).

Common situations: Product unpublished during a catalog update while storefront links remain; consumer browsing a stale URL; product not assigned to the sales channel/region the request resolves to.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/5f92af9ce1967073. Report an issue: GitHub.