medusajs/medusa · error · MedusaError

Service zone with id: ${req.params.zone_id} not found

Error message

Service zone with id: ${req.params.zone_id} not found

What it means

The GET /admin/fulfillment-sets/:id/service-zones/:zone_id route queries for the service zone scoped to the fulfillment set; if no zone matches it throws NOT_FOUND (HTTP 404).

Source

Thrown at packages/medusa/src/api/admin/fulfillment-sets/[id]/service-zones/[zone_id]/route.ts:40

export const GET = async (
  req: AuthenticatedMedusaRequest<HttpTypes.AdminServiceZonesParams>,
  res: MedusaResponse<AdminServiceZoneResponse>
) => {
  const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)

  const [service_zone] = await remoteQuery(
    remoteQueryObjectFromString({
      entryPoint: "service_zones",
      variables: {
        id: req.params.zone_id,
      },
      fields: req.queryConfig.fields,
    })
  )

  if (!service_zone) {
    throw new MedusaError(
      MedusaError.Types.NOT_FOUND,
      `Service zone with id: ${req.params.zone_id} not found`
    )
  }

  res.status(200).json({ service_zone })
}

export const POST = async (
  req: MedusaRequest<
    HttpTypes.AdminUpdateFulfillmentSetServiceZone,
    HttpTypes.AdminServiceZonesParams
  >,
  res: MedusaResponse<AdminFulfillmentSetResponse>
) => {
  const fulfillmentModuleService = req.scope.resolve<IFulfillmentModuleService>(
    Modules.FULFILLMENT
  )

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. List zones via GET /admin/fulfillment-sets/:id/service-zones and use those ids
  2. Verify the zone belongs to the given fulfillment set
  3. Handle 404 by returning to the fulfillment set detail view
Defensive patterns

Strategy: try-catch

Validate before calling

const { service_zones } = await getFulfillmentSetZones(setId)
if (!service_zones.some((z) => z.id === zoneId)) throw new Error("zone not in set")

Type guard

const zoneBelongsToSet = (zones: {id:string}[], zoneId: string) =>
  zones.some((z) => z.id === zoneId)

Try / catch

try { await getZone(setId, zoneId) } catch (e) { if (e.statusCode === 404) navigate(`/fulfillment-sets/${setId}`) else throw e }

Prevention

When it happens

Trigger: GET /admin/fulfillment-sets/:id/service-zones/:zone_id where zone_id is wrong or belongs to a different fulfillment set.

Common situations: Zone deleted or moved to another fulfillment set while its page was open; copy-paste of zone ids between sets.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/a082dc4463daf40f. Report an issue: GitHub.