{"record":{"id":"f546fb3fea715ca2","repo":"hcengineering/platform","slug":"reply-error","errorCode":null,"errorMessage":"${reply.error}","messagePattern":"\\$\\{reply\\.error\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/hulypulse-client/src/client.ts","lineNumber":291,"sourceCode":"    this.closed_manually = true\n    if (this.reconnectTimeout !== undefined) {\n      clearTimeout(this.reconnectTimeout)\n    }\n    this.reconnectTimeout = undefined\n    this.stopPing()\n    this.ws?.close()\n  }\n\n  static async connect (url: string | URL): Promise<HulypulseClient> {\n    const client = new HulypulseClient(url)\n    await client.connect()\n    return client\n  }\n\n  public async info (): Promise<string> {\n    const reply = await this.send({ type: 'info' })\n    if (reply.error !== undefined) {\n      throw new Error(reply.error)\n    }\n    return reply.result ?? ''\n  }\n\n  public async list (): Promise<string> {\n    const reply = await this.send({ type: 'list' })\n    if (reply.error !== undefined) {\n      throw new Error(reply.error)\n    }\n    return reply.result ?? ''\n  }\n\n  public async subscribe (key: string, callback: Callback<any>): Promise<UnsubscribeCallback> {\n    let list = this.subscribes.get(key)\n    if (list === undefined) {\n      list = []\n      this.subscribes.set(key, list)\n    }","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/hulypulse-client/src/client.ts#L273-L309","documentation":"HulyPulse client's info() sends an { type: 'info' } request over the websocket and expects a reply without an error field. If the server includes reply.error, the client throws it verbatim as an Error. This surfaces server-side rejections (bad request type, permissions, internal failure) directly to the caller.","triggerScenarios":"Calling client.info() when the pulse server rejects the info request — e.g. unsupported message type, the session is not authorized, or the server handler failed and returned { error: '...' }.","commonSituations":"Client/server version mismatch so the 'info' op is unsupported; connecting to a pulse server that requires auth before info; server-side exception while gathering info.","solutions":["Check the thrown message for the server-side reason and fix the underlying cause (auth, unsupported op).","Verify client and hulypulse server versions are compatible so the 'info' message type is supported.","Ensure any required authentication/handshake is completed before calling info().","Check pulse server logs for the error returned in reply.error."],"exampleFix":"// before\nconst info = await client.info() // Error: unauthorized\n// after\nawait client.authenticate(token) // or connect with credentials first\nconst info = await client.info()","handlingStrategy":"try-catch","validationCode":"if (!client.connected) await client.connect() // ensure session/auth is established before info()","typeGuard":"function hasError(r: { error?: string }): r is { error: string } {\n  return r.error !== undefined\n}","tryCatchPattern":"try {\n  const info = await client.info()\n} catch (e) {\n  // message is the server-side error from reply.error\n  console.error('hulypulse info failed:', e.message)\n  if (/unauthorized|auth/i.test(e.message)) await client.authenticate(token)\n  else if (/unknown|unsupported/i.test(e.message)) console.error('client/server version mismatch')\n  else throw e\n}","preventionTips":["Complete authentication/handshake before sending 'info' requests","Keep hulypulse client and server versions aligned","Log reply.error contents server-side to correlate failures","Wrap RPC-style client methods in try/catch since server errors throw verbatim"],"tags":["websocket","rpc","server-error"],"backgroundTag":"rpc-server-error","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}