{"record":{"id":"eb575b09873cb769","repo":"toeverything/AFFiNE","slug":"handler-for-operation-op-name-is-not-register","errorCode":null,"errorMessage":"Handler for operation [${op.name}] is not registered.","messagePattern":"Handler for operation \\[(.+?)\\] is not registered\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/common/infra/src/op/consumer.ts","lineNumber":252,"sourceCode":"  ) {\n    this.eventBus.on(`before:${op}`, handler);\n  }\n\n  after<Op extends OpNames<Ops>>(\n    op: Op,\n    handler: (...args: [...OpInput<Ops, Op>, OpOutput<Ops, Op>]) => void\n  ) {\n    this.eventBus.on(`after:${op}`, handler);\n  }\n\n  /**\n   * @internal\n   */\n  ob$(op: CallMessage | SubscribeMessage, signal: AbortSignal) {\n    return defer(() => {\n      const handler = this.registeredOpHandlers.get(op.name as any);\n      if (!handler) {\n        throw new Error(\n          `Handler for operation [${op.name}] is not registered.`\n        );\n      }\n\n      const ret$ = handler(op.payload, { signal });\n\n      let ob$: Observable<any>;\n      if (ret$ instanceof Promise) {\n        ob$ = from(ret$);\n      } else if (ret$ instanceof Observable) {\n        ob$ = ret$;\n      } else {\n        ob$ = of(ret$);\n      }\n\n      return ob$.pipe(takeUntil(fromEvent(signal, 'abort')));\n    });\n  }","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/common/infra/src/op/consumer.ts#L234-L270","documentation":"ob$ looks up the registered handler for an incoming call/subscribe operation and throws when the op name was never registered, so remote operation requests for unknown operations fail immediately instead of hanging.","triggerScenarios":"Thrown at packages/common/infra/src/op/consumer.ts:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Register a handler for the named operation before consuming it.","Check the operation name for typos and ensure the producer and consumer agree on it.","Confirm the module registering the handler is loaded before the operation is invoked."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}