{"record":{"id":"0b2d220bb1c3d25e","repo":"medusajs/medusa","slug":"invalid-geo-zone-type-geozone-type","errorCode":null,"errorMessage":"Invalid geo zone type: ${geoZone.type}","messagePattern":"Invalid geo zone type: (.+?)","errorType":"validation","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/modules/fulfillment/src/services/fulfillment-module-service.ts","lineNumber":2161,"sourceCode":"    }\n  }\n\n  protected static validateGeoZones(\n    geoZones: (\n      | (Partial<FulfillmentTypes.CreateGeoZoneDTO> & { type: string })\n      | (Partial<FulfillmentTypes.UpdateGeoZoneDTO> & { type: string })\n    )[]\n  ) {\n    const requirePropForType = {\n      country: [\"country_code\"],\n      province: [\"country_code\", \"province_code\"],\n      city: [\"country_code\", \"province_code\", \"city\"],\n      zip: [\"country_code\", \"province_code\", \"city\", \"postal_expression\"],\n    }\n\n    for (const geoZone of geoZones) {\n      if (!requirePropForType[geoZone.type]) {\n        throw new MedusaError(\n          MedusaError.Types.INVALID_DATA,\n          `Invalid geo zone type: ${geoZone.type}`\n        )\n      }\n\n      for (const prop of requirePropForType[geoZone.type]) {\n        if (!geoZone[prop]) {\n          throw new MedusaError(\n            MedusaError.Types.INVALID_DATA,\n            `Missing required property ${prop} for geo zone type ${geoZone.type}`\n          )\n        }\n      }\n    }\n  }\n\n  protected static normalizeListShippingOptionsForContextParams(\n    filters: FulfillmentTypes.FilterableShippingOptionForContextProps,","sourceCodeStart":2143,"sourceCodeEnd":2179,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/modules/fulfillment/src/services/fulfillment-module-service.ts#L2143-L2179","documentation":"Thrown when creating/updating geo zones with a `type` that is not one of the recognized geo zone types (country, province, city, zip). The module validates the type against a required-properties map before persisting; unknown types have no entry and are rejected as INVALID_DATA.","triggerScenarios":"createGeoZones / updateGeoZones with type values like 'region', 'state', postal', typos, or unvalidated user input from an API form.","commonSituations":"Admin custom UI passing free-text zone types; integrating external address taxonomies whose type names differ from Medusa's four canonical types.","solutions":["Use only 'country' | 'province' | 'city' | 'zip'","Map external type names to Medusa's types before calling the service","Validate/whitelist the field at your API boundary"],"exampleFix":"// before\nawait service.createGeoZones([{ type: 'state', country_code: 'us' }])\n// after\nawait service.createGeoZones([{ type: 'province', country_code: 'us', province_code: 'ca' }])","handlingStrategy":"type-guard","validationCode":"const GEO_ZONE_TYPES = ['country','province','city','zip'] as const\nif (!GEO_ZONE_TYPES.includes(zone.type)) throw new Error(`Invalid geo zone type: ${zone.type}`)","typeGuard":"type GeoZoneType = 'country' | 'province' | 'city' | 'zip'\nconst isGeoZoneType = (t: string): t is GeoZoneType => ['country','province','city','zip'].includes(t)","tryCatchPattern":null,"preventionTips":["Whitelist the four canonical types in forms and importers","Map external taxonomies to Medusa types at the boundary"],"tags":["fulfillment","geo-zone","validation","invalid-data"],"backgroundTag":"enum-validation-failed","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}