{"record":{"id":"3cfa05315986b29a","repo":"medusajs/medusa","slug":"subscriber-registration-requires-subscriberid-rec","errorCode":null,"errorMessage":"Subscriber registration requires subscriberId. Received: ${JSON.stringify(data)}","messagePattern":"Subscriber registration requires subscriberId\\. Received: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/utils/src/dev-server/handlers/subscriber-handler.ts","lineNumber":26,"sourceCode":"  implements ResourceTypeHandler<SubscriberResourceData>\n{\n  readonly type = \"subscriber\"\n\n  validate(data: SubscriberResourceData): void {\n    if (!data.id) {\n      throw new Error(\n        `Subscriber registration requires id. Received: ${JSON.stringify(data)}`\n      )\n    }\n\n    if (!data.sourcePath) {\n      throw new Error(\n        `Subscriber registration requires sourcePath. Received: ${JSON.stringify(\n          data\n        )}`\n      )\n    }\n\n    if (!data.subscriberId) {\n      throw new Error(\n        `Subscriber registration requires subscriberId. Received: ${JSON.stringify(\n          data\n        )}`\n      )\n    }\n\n    if (!data.events) {\n      throw new Error(\n        `Subscriber registration requires events. Received: ${JSON.stringify(\n          data\n        )}`\n      )\n    }\n\n    if (!Array.isArray(data.events)) {\n      throw new Error(","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/utils/src/dev-server/handlers/subscriber-handler.ts#L8-L44","documentation":"Dev-server validation error from SubscriberHandler.validate: a subscriber resource was registered without `subscriberId`. The subscriberId identifies the concrete subscriber handler (distinct from the registration id) and is required for the dev server to track the right handler for hot-reload.","triggerScenarios":"Registering a subscriber where the subscriberId field is missing or undefined — e.g. passing only the module id and events; constructing registration data from an object that stores the handler's key under a different name (like `handlerId`).","commonSituations":"Custom subscriber loaders copying fields selectively and dropping subscriberId; refactors renaming the property; subscribers defined via a factory where the generated id is not propagated to the registration.","solutions":["Include subscriberId in the registration data — typically the constructor-based or exported subscriber identifier.","If the value lives in your subscriber config under another key, map it explicitly to subscriberId before registering.","Add a dev-time assertion so a missing subscriberId fails fast with your own clearer message."],"exampleFix":"// before\nregisterDevServerResource({ type: 'subscriber', id, sourcePath, events })\n\n// after\nregisterDevServerResource({ type: 'subscriber', id, sourcePath, subscriberId: 'order-placed-handler', events })","handlingStrategy":"validation","validationCode":"if (!data.subscriberId) throw new Error(`Subscriber ${data.id} missing subscriberId`)","typeGuard":"function hasSubscriberId(d: unknown): d is { subscriberId: string } {\n  return typeof (d as any)?.subscriberId === 'string' && (d as any).subscriberId.length > 0\n}","tryCatchPattern":null,"preventionTips":["Map your internal handler key to subscriberId explicitly at registration.","Type the registration payload so missing fields fail at compile time.","Keep a checklist of required subscriber fields: id, sourcePath, subscriberId, events."],"tags":["dev-server","subscriber","registration","validation"],"backgroundTag":"missing-required-field-registration","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}