medusajs/medusa · error · MedusaError
Customer group with id: ${req.params.id} not found
Error message
Customer group with id: ${req.params.id} not found What it means
The GET /admin/customer-groups/:id route refetches the customer group via remote query and throws NOT_FOUND (HTTP 404) when the id does not match any group.
Source
Thrown at packages/medusa/src/api/admin/customer-groups/[id]/route.ts:25
MedusaResponse,
} from "@medusajs/framework/http"
import { MedusaError } from "@medusajs/framework/utils"
import { refetchCustomerGroup } from "../helpers"
import { HttpTypes } from "@medusajs/framework/types"
export const GET = async (
req: AuthenticatedMedusaRequest<HttpTypes.SelectParams>,
res: MedusaResponse<HttpTypes.AdminCustomerGroupResponse>
) => {
const customerGroup = await refetchCustomerGroup(
req.params.id,
req.scope,
req.queryConfig.fields
)
if (!customerGroup) {
throw new MedusaError(
MedusaError.Types.NOT_FOUND,
`Customer group with id: ${req.params.id} not found`
)
}
res.status(200).json({ customer_group: customerGroup })
}
export const POST = async (
req: AuthenticatedMedusaRequest<
HttpTypes.AdminUpdateCustomerGroup,
HttpTypes.SelectParams
>,
res: MedusaResponse<HttpTypes.AdminCustomerGroupResponse>
) => {
const existingCustomerGroup = await refetchCustomerGroup(
req.params.id,
req.scope,View on GitHub (pinned to 5e06e544a2)
Solutions
- List groups via GET /admin/customer-groups to confirm the id
- Handle 404 by routing back to the groups list
- Verify backend URL/environment
Defensive patterns
Strategy: try-catch
Validate before calling
const { customer_groups } = await sdk.admin.customerGroup.list({ id })
if (!customer_groups.length) throw new Error("group not found") Type guard
null
Try / catch
try { await getGroup(id) } catch (e) { if (e.statusCode === 404) navigate("/customer-groups") else throw e } Prevention
- Refresh group references after deletions
- Guard detail routes with existence checks
When it happens
Trigger: GET /admin/customer-groups/:id with a deleted or nonexistent group id.
Common situations: Group deleted while its detail page was open; stale links from notifications; environment mismatch.
Related errors
- Customer group 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/be33f174c8c43551.
Report an issue: GitHub.