medusajs/medusa · error · MedusaError
Customer with id: ${req.params.id} not found
Error message
Customer with id: ${req.params.id} not found What it means
The GET /admin/customers/:id route refetches the customer via remote query; when no customer matches the id it throws NOT_FOUND (HTTP 404).
Source
Thrown at packages/medusa/src/api/admin/customers/[id]/route.ts:25
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "@medusajs/framework/http"
import { refetchCustomer } from "../helpers"
import { AdminUpdateCustomerType } from "../validators"
export const GET = async (
req: AuthenticatedMedusaRequest<{}, HttpTypes.AdminCustomerParams>,
res: MedusaResponse<HttpTypes.AdminCustomerResponse>
) => {
const customer = await refetchCustomer(
req.params.id,
req.scope,
req.queryConfig.fields
)
if (!customer) {
throw new MedusaError(
MedusaError.Types.NOT_FOUND,
`Customer with id: ${req.params.id} not found`
)
}
res.status(200).json({ customer })
}
export const POST = async (
req: AuthenticatedMedusaRequest<
AdminUpdateCustomerType & AdditionalData,
HttpTypes.SelectParams
>,
res: MedusaResponse<HttpTypes.AdminCustomerResponse>
) => {
const existingCustomer = await refetchCustomer(req.params.id, req.scope, [
"id",
])View on GitHub (pinned to 5e06e544a2)
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
Defensive patterns
Strategy: try-catch
Validate before calling
const { customers } = await sdk.admin.customer.list({ id })
if (!customers.length) throw new Error("customer not found") Type guard
null
Try / catch
try { await getCustomer(id) } catch (e) { if (e.statusCode === 404) showDeletedCustomerNotice() else throw e } Prevention
- Expect customer deletion (GDPR) and design 404 handling
- Never persist raw customer ids without a re-check
When it happens
Trigger: GET /admin/customers/:id with an unknown, deleted, or mistyped customer id.
Common situations: Customer records removed for GDPR/privacy compliance while links remain; guest customer ids reused incorrectly; environment mismatch.
Related errors
- Customer with id "${req.params.id}" not found
- Campaign with id: ${req.params.id} was not found
- Campaign with id "${req.params.id}" not found
- Claim with id: ${req.params.id} was not found
- Currency with code: ${req.params.code} was not found
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/3b790fa80cdeb733.
Report an issue: GitHub.