{"record":{"id":"3b790fa80cdeb733","repo":"medusajs/medusa","slug":"customer-with-id-req-params-id-not-found","errorCode":null,"errorMessage":"Customer with id: ${req.params.id} not found","messagePattern":"Customer with id: (.+?) not found","errorType":"http","errorClass":"MedusaError","httpStatus":404,"severity":"error","filePath":"packages/medusa/src/api/admin/customers/[id]/route.ts","lineNumber":25,"sourceCode":"import {\n  AuthenticatedMedusaRequest,\n  MedusaResponse,\n} from \"@medusajs/framework/http\"\nimport { refetchCustomer } from \"../helpers\"\nimport { AdminUpdateCustomerType } from \"../validators\"\n\nexport const GET = async (\n  req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminCustomerParams>,\n  res: MedusaResponse<HttpTypes.AdminCustomerResponse>\n) => {\n  const customer = await refetchCustomer(\n    req.params.id,\n    req.scope,\n    req.queryConfig.fields\n  )\n\n  if (!customer) {\n    throw new MedusaError(\n      MedusaError.Types.NOT_FOUND,\n      `Customer with id: ${req.params.id} not found`\n    )\n  }\n\n  res.status(200).json({ customer })\n}\n\nexport const POST = async (\n  req: AuthenticatedMedusaRequest<\n    AdminUpdateCustomerType & AdditionalData,\n    HttpTypes.SelectParams\n  >,\n  res: MedusaResponse<HttpTypes.AdminCustomerResponse>\n) => {\n  const existingCustomer = await refetchCustomer(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/customers/[id]/route.ts#L7-L43","documentation":"The GET /admin/customers/:id route refetches the customer via remote query; when no customer matches the id it throws NOT_FOUND (HTTP 404).","triggerScenarios":"GET /admin/customers/:id with an unknown, deleted, or mistyped customer id.","commonSituations":"Customer records removed for GDPR/privacy compliance while links remain; guest customer ids reused incorrectly; environment mismatch.","solutions":["Confirm the id via GET /admin/customers with a filter","Treat 404 as 'customer deleted' and clean up references","Check you are querying the right environment"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const { customers } = await sdk.admin.customer.list({ id })\nif (!customers.length) throw new Error(\"customer not found\")","typeGuard":"null","tryCatchPattern":"try { await getCustomer(id) } catch (e) { if (e.statusCode === 404) showDeletedCustomerNotice() else throw e }","preventionTips":["Expect customer deletion (GDPR) and design 404 handling","Never persist raw customer ids without a re-check"],"tags":["admin-api","customers","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"}