medusajs/medusa · error · MedusaError
NOT_FOUND
NOT_FOUND
Error message
Product category with id: ${req.params.id} was not found What it means
Thrown by GET /store/product-categories/:id when the remote query for the category returns no result for the given id. The id may be invalid, the category may not exist, or it may be filtered out (e.g. not visible in the store scope). Returns a 404 NOT_FOUND.
Source
Thrown at packages/medusa/src/api/store/product-categories/[id]/route.ts:30
export const GET = async (
req: AuthenticatedMedusaRequest<StoreProductCategoryParamsType>,
res: MedusaResponse<StoreProductCategoryResponse>
) => {
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
const { data: category } = await query.graph(
{
entity: "product_category",
filters: { id: req.params.id, ...req.filterableFields },
fields: req.queryConfig.fields,
},
{
locale: req.locale,
}
)
if (!category) {
throw new MedusaError(
MedusaError.Types.NOT_FOUND,
`Product category with id: ${req.params.id} was not found`
)
}
res.json({ product_category: category[0] })
}
View on GitHub (pinned to 5e06e544a2)
Solutions
- Verify the id exists via GET /store/product-categories and use the returned id
- If the category was deleted, remove or update the storefront link that references it
- Check the category is not internal/hidden if it should be visible
Example fix
// before
const { product_category } = await sdk.store.productCategory.retrieve('my-category-handle') // 404
// after
const { product_category } = await sdk.store.productCategory.retrieve('pcat_123') Defensive patterns
Strategy: try-catch
Validate before calling
const { product_categories } = await sdk.store.productCategory.list({ q: slugOrId })
if (!product_categories.length) notFound() Try / catch
try {
const { product_category } = await sdk.store.productCategory.retrieve(id)
} catch (e: any) {
if (e.type === 'not_found') notFound()
throw e
} Prevention
- Use ids returned by the list endpoint, not guesses
- Purge cached category links on deletion
- Render 404 pages for category routes
When it happens
Trigger: Requesting /store/product-categories/pcat_... with a wrong/deleted id, a handle used instead of id, or a category that is internal/not available to the store.
Common situations: Stale URLs/bookmarks after category deletion; using the category handle instead of its id; category marked as internal; frontend caching old category links.
Related errors
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/3d2e9e1d6609cc41.
Report an issue: GitHub.