{"record":{"id":"a804f04494f2627c","repo":"medusajs/medusa","slug":"zone-property-is-not-a-valid-injection-zone","errorCode":null,"errorMessage":"'zone' property is not a valid injection zone.","messagePattern":"'zone' property is not a valid injection zone\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/admin/admin-vite-plugin/src/widgets/generate-widgets.ts","lineNumber":312,"sourceCode":"          )\n          if (zoneProperty?.type === \"ObjectProperty\") {\n            extractZoneValues(zoneProperty.value, zones, file)\n            zoneFound = true\n          }\n        }\n      }\n    },\n  })\n\n  if (!zoneFound) {\n    logger.warn(`'zone' property is missing from the widget config.`, { file })\n    return null\n  }\n\n  const validatedZones = zones.filter(isValidInjectionZone)\n\n  if (validatedZones.length === 0) {\n    logger.warn(`'zone' property is not a valid injection zone.`, {\n      file,\n    })\n    return null\n  }\n\n  return validatedZones\n}\n\nfunction extractZoneValues(value: Node, zones: string[], file: string) {\n  if (isTemplateLiteral(value)) {\n    logger.warn(\n      `'zone' property cannot be a template literal (e.g. \\`product.details.after\\`).`,\n      { file }\n    )\n    return\n  }\n\n  if (isStringLiteral(value)) {","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/admin/admin-vite-plugin/src/widgets/generate-widgets.ts#L294-L330","documentation":"After collecting zone strings from the config, each is checked against the list of valid admin injection zones (e.g. product.details.after, customer.details.before...). If none of the provided strings is a valid zone, the widget is skipped with this warning.","triggerScenarios":"Passing misspelled or unsupported zones like \"product.details.afters\", \"order.side\", or a zone removed/renamed in the current admin version.","commonSituations":"See trigger scenarios.","solutions":["Use a valid injection zone string; check the InjectionZone enum in @medusajs/admin-sdk for the exact list","Prefer the enum constant, e.g. zone: InjectionZone.ProductDetailsAfter, but written as a string literal if using defineWidgetConfig","Upgrade @medusajs/admin-vite-plugin if the zone was added recently"],"exampleFix":"// before\nexport const config = defineWidgetConfig({ zone: \"product.details.afters\" })\n\n// after\nexport const config = defineWidgetConfig({ zone: \"product.details.after\" })","handlingStrategy":"validation","validationCode":"import { InjectionZone } from \"@medusajs/admin-sdk\"\nconst valid = new Set<string>(Object.values(InjectionZone))\nconst zones = Array.isArray(config.zone) ? config.zone : [config.zone]\nif (!zones.some(z => valid.has(z))) throw new Error(`No valid injection zone in ${zones.join(\",\")}`)","typeGuard":"const isValidZone = (z: string): z is InjectionZone =>\n  Object.values(InjectionZone).includes(z as InjectionZone)","tryCatchPattern":null,"preventionTips":["Reference the InjectionZone enum/union type from @medusajs/admin-sdk instead of hand-typing strings","Re-check zone names when upgrading Medusa versions — zones change between releases"],"tags":["admin","widgets","zone","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}