{"record":{"id":"0553cca81685c787","repo":"medusajs/medusa","slug":"subscriber-registration-requires-id-received-j","errorCode":null,"errorMessage":"Subscriber registration requires id. Received: ${JSON.stringify(data)}","messagePattern":"Subscriber registration requires id\\. Received: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/utils/src/dev-server/handlers/subscriber-handler.ts","lineNumber":12,"sourceCode":"import {\n  ResourceEntry,\n  ResourceTypeHandler,\n  SubscriberResourceData,\n} from \"../types\"\n\nexport class SubscriberHandler\n  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","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/utils/src/dev-server/handlers/subscriber-handler.ts#L1-L30","documentation":"Dev-server validation error from SubscriberHandler.validate: a subscriber resource was registered without an `id`. The id identifies the subscriber for tracking and hot-reload, so registration is rejected before the subscriber is watched.","triggerScenarios":"Calling subscriber registration with a payload lacking the id field; loaders that construct subscriber metadata from a config object whose id key is absent or undefined.","commonSituations":"Writing custom subscribers in a Medusa project and passing an incomplete registration object; refactor where the id property was renamed but registration still reads the old key; plugin auto-registration scanning subscriber files that export no id.","solutions":["Include a unique, stable id in the subscriber registration data.","If the id derives from a config value, default it explicitly (e.g. id = config.id ?? `${sourcePath}`) so it can never be undefined.","Ensure the full required set is present: id, sourcePath, subscriberId, events (array)."],"exampleFix":"// before\nregisterDevServerResource({ type: 'subscriber', sourcePath, subscriberId, events })\n\n// after\nregisterDevServerResource({ type: 'subscriber', id: 'order-sub', sourcePath, subscriberId, events })","handlingStrategy":"validation","validationCode":"if (!data.id) throw new Error(`Missing subscriber id: ${JSON.stringify(data)}`)","typeGuard":"function isSubscriberResourceData(d: unknown): d is SubscriberResourceData {\n  const v = d as any\n  return typeof v?.id === 'string' && typeof v?.sourcePath === 'string' && typeof v?.subscriberId === 'string' && Array.isArray(v?.events)\n}","tryCatchPattern":null,"preventionTips":["Construct all subscriber registration data through one typed factory.","Default the registration id from the subscriber file path when no explicit id exists.","Fail fast in dev with your own validation before the dev server rejects it."],"tags":["dev-server","subscriber","registration","validation","hot-reload"],"backgroundTag":"missing-required-field-registration","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}