{"record":{"id":"8c99c848b1f7c5c3","repo":"paperclipai/paperclip","slug":"plugin-pluginid-must-provide-a-companyid-when","errorCode":null,"errorMessage":"Plugin \"${pluginId}\" must provide a companyId when emitting events.","messagePattern":"Plugin \"(.+?)\" must provide a companyId when emitting events\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/plugin-event-bus.ts","lineNumber":257,"sourceCode":"      },\n\n      /**\n       * Emit a plugin-namespaced event. The event type is automatically\n       * prefixed with `plugin.<pluginId>.` so:\n       * - `emit(\"sync-done\", payload)` becomes `\"plugin.acme.linear.sync-done\"`.\n       *\n       * Requires the `events.emit` capability (enforced by the host layer).\n       *\n       * @throws {Error} if `name` already contains the `plugin.` prefix\n       *   (prevents cross-namespace spoofing).\n       */\n      async emit(name: string, companyId: string, payload: unknown): Promise<PluginEventBusEmitResult> {\n        if (!name || name.trim() === \"\") {\n          throw new Error(`Plugin \"${pluginId}\" must provide a non-empty event name.`);\n        }\n\n        if (!companyId || companyId.trim() === \"\") {\n          throw new Error(`Plugin \"${pluginId}\" must provide a companyId when emitting events.`);\n        }\n\n        if (name.startsWith(\"plugin.\")) {\n          throw new Error(\n            `Plugin \"${pluginId}\" must not include the \"plugin.\" prefix when emitting events. ` +\n            `Emit the bare event name (e.g. \"sync-done\") and the bus will namespace it automatically.`,\n          );\n        }\n\n        const eventType = `plugin.${pluginId}.${name}` as const;\n        const event: PluginEvent = {\n          eventId: crypto.randomUUID(),\n          eventType,\n          companyId,\n          occurredAt: new Date().toISOString(),\n          actorType: \"plugin\",\n          actorId: pluginId,\n          payload,","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/plugin-event-bus.ts#L239-L275","documentation":"Scope guard in emit: companyId is missing/falsy. Every plugin event must be scoped to a company for routing and tenant isolation, so emitting without one is rejected; the missing companyId argument is at fault.","triggerScenarios":"Thrown at server/src/services/plugin-event-bus.ts:257 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include the companyId when emitting plugin events."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}