{"record":{"id":"7c1fcad7a7a1185b","repo":"medusajs/medusa","slug":"campaign-with-id-req-params-id-was-not-found","errorCode":null,"errorMessage":"Campaign with id: ${req.params.id} was not found","messagePattern":"Campaign with id: (.+?) was not found","errorType":"http","errorClass":"MedusaError","httpStatus":404,"severity":"error","filePath":"packages/medusa/src/api/admin/campaigns/[id]/route.ts","lineNumber":25,"sourceCode":"  updateCampaignsWorkflow,\n} from \"@medusajs/core-flows\"\n\nimport { refetchCampaign } from \"../helpers\"\nimport { MedusaError } from \"@medusajs/framework/utils\"\nimport { AdditionalData, HttpTypes } from \"@medusajs/framework/types\"\n\nexport const GET = async (\n  req: AuthenticatedMedusaRequest<HttpTypes.AdminGetCampaignParams>,\n  res: MedusaResponse<HttpTypes.AdminCampaignResponse>\n) => {\n  const campaign = await refetchCampaign(\n    req.params.id,\n    req.scope,\n    req.queryConfig.fields\n  )\n\n  if (!campaign) {\n    throw new MedusaError(\n      MedusaError.Types.NOT_FOUND,\n      `Campaign with id: ${req.params.id} was not found`\n    )\n  }\n\n  res.status(200).json({ campaign })\n}\n\nexport const POST = async (\n  req: AuthenticatedMedusaRequest<\n    HttpTypes.AdminUpdateCampaign & AdditionalData,\n    HttpTypes.AdminGetCampaignParams\n  >,\n  res: MedusaResponse<HttpTypes.AdminCampaignResponse>\n) => {\n  const existingCampaign = await refetchCampaign(req.params.id, req.scope, [\n    \"id\",\n  ])","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/medusa/src/api/admin/campaigns/[id]/route.ts#L7-L43","documentation":"The GET /admin/campaigns/:id route refetches the campaign (promotion module) and throws NOT_FOUND (HTTP 404) when no campaign with that id exists.","triggerScenarios":"GET /admin/campaigns/:id with a nonexistent, deleted, or mistyped campaign id.","commonSituations":"Campaign deleted by another admin while its detail page was open; deep links to removed campaigns; id copied across environments.","solutions":["List campaigns with GET /admin/campaigns to confirm the id","Handle 404 in the client by redirecting to the campaigns list","Ensure your backend URL matches the environment that owns the campaign"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const { campaigns } = await sdk.promotion.listCampaigns({ id: campaignId })\nif (!campaigns.length) throw new Error(\"campaign gone\")","typeGuard":"null","tryCatchPattern":"try { await fetchCampaign(id) } catch (e) { if (e.statusCode === 404) redirect(\"/campaigns\") else throw e }","preventionTips":["Check existence before deep-linking","Handle 404 by returning to list views"],"tags":["admin-api","campaigns","promotions","not-found"],"backgroundTag":"http-404-resource-not-found","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}