{"record":{"id":"488537eecf3ee3cd","repo":"medusajs/medusa","slug":"subscriber-registration-requires-sourcepath-recei","errorCode":null,"errorMessage":"Subscriber registration requires sourcePath. Received: ${JSON.stringify(data)}","messagePattern":"Subscriber registration requires sourcePath\\. Received: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/utils/src/dev-server/handlers/subscriber-handler.ts","lineNumber":18,"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\n        )}`\n      )\n    }\n\n    if (!data.events) {\n      throw new Error(","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/utils/src/dev-server/handlers/subscriber-handler.ts#L1-L36","documentation":"Dev-server validation error from SubscriberHandler.validate: a subscriber resource was registered without `sourcePath`, the path of the file defining the subscriber. The dev server requires it to watch the file and hot-reload the subscriber when it changes; registration is therefore rejected.","triggerScenarios":"Registering a subscriber with { type: 'subscriber', id, subscriberId, events } but no sourcePath; loaders that register subscribers from a central index without forwarding the defining file's path.","commonSituations":"Plugins registering subscribers discovered by directory scanning where the path is dropped; path derivation from import.meta.url that breaks after bundling or on Windows.","solutions":["Pass the absolute path of the subscriber module file (fileURLToPath(import.meta.url) at the registration site).","Thread the file path through your loader so each subscriber registration carries its own path.","Assert sourcePath is a non-empty string right before registering."],"exampleFix":"// before\nregisterDevServerResource({ type: 'subscriber', id, subscriberId, events })\n\n// after\nregisterDevServerResource({\n  type: 'subscriber', id, subscriberId, events,\n  sourcePath: fileURLToPath(import.meta.url),\n})","handlingStrategy":"validation","validationCode":"import { fileURLToPath } from 'node:url'\nconst sourcePath = fileURLToPath(import.meta.url)\nif (!sourcePath) throw new Error('sourcePath could not be derived')","typeGuard":"function hasSourcePath(d: unknown): d is { sourcePath: string } {\n  return typeof (d as any)?.sourcePath === 'string' && (d as any).sourcePath.length > 0\n}","tryCatchPattern":null,"preventionTips":["Derive sourcePath from import.meta.url at the registration site.","Forward file paths through loaders instead of registering from a central index.","Assert non-empty path before registering."],"tags":["dev-server","subscriber","source-path","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"}