{"record":{"id":"3d2e9e1d6609cc41","repo":"medusajs/medusa","slug":"not-found-3d2e9e","errorCode":"NOT_FOUND","errorMessage":"Product category with id: ${req.params.id} was not found","messagePattern":"Product category with id: (.+?) was not found","errorType":"exception","errorClass":"MedusaError","httpStatus":404,"severity":"error","filePath":"packages/medusa/src/api/store/product-categories/[id]/route.ts","lineNumber":30,"sourceCode":"export const GET = async (\n  req: AuthenticatedMedusaRequest<StoreProductCategoryParamsType>,\n  res: MedusaResponse<StoreProductCategoryResponse>\n) => {\n  const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)\n\n  const { data: category } = await query.graph(\n    {\n      entity: \"product_category\",\n      filters: { id: req.params.id, ...req.filterableFields },\n      fields: req.queryConfig.fields,\n    },\n    {\n      locale: req.locale,\n    }\n  )\n\n  if (!category) {\n    throw new MedusaError(\n      MedusaError.Types.NOT_FOUND,\n      `Product category with id: ${req.params.id} was not found`\n    )\n  }\n\n  res.json({ product_category: category[0] })\n}\n","sourceCodeStart":12,"sourceCodeEnd":38,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/medusa/src/api/store/product-categories/[id]/route.ts#L12-L38","documentation":"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.","triggerScenarios":"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.","commonSituations":"Stale URLs/bookmarks after category deletion; using the category handle instead of its id; category marked as internal; frontend caching old category links.","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"],"exampleFix":"// before\nconst { product_category } = await sdk.store.productCategory.retrieve('my-category-handle') // 404\n\n// after\nconst { product_category } = await sdk.store.productCategory.retrieve('pcat_123')","handlingStrategy":"try-catch","validationCode":"const { product_categories } = await sdk.store.productCategory.list({ q: slugOrId })\nif (!product_categories.length) notFound()","typeGuard":null,"tryCatchPattern":"try {\n  const { product_category } = await sdk.store.productCategory.retrieve(id)\n} catch (e: any) {\n  if (e.type === 'not_found') notFound()\n  throw e\n}","preventionTips":["Use ids returned by the list endpoint, not guesses","Purge cached category links on deletion","Render 404 pages for category routes"],"tags":["store-api","product-category","not-found"],"backgroundTag":"resource-not-found-by-id","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}