hcengineering/platform · error

${reply.error}

Error message

${reply.error}

What it means

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.

Source

Thrown at packages/hulypulse-client/src/client.ts:291

    this.closed_manually = true
    if (this.reconnectTimeout !== undefined) {
      clearTimeout(this.reconnectTimeout)
    }
    this.reconnectTimeout = undefined
    this.stopPing()
    this.ws?.close()
  }

  static async connect (url: string | URL): Promise<HulypulseClient> {
    const client = new HulypulseClient(url)
    await client.connect()
    return client
  }

  public async info (): Promise<string> {
    const reply = await this.send({ type: 'info' })
    if (reply.error !== undefined) {
      throw new Error(reply.error)
    }
    return reply.result ?? ''
  }

  public async list (): Promise<string> {
    const reply = await this.send({ type: 'list' })
    if (reply.error !== undefined) {
      throw new Error(reply.error)
    }
    return reply.result ?? ''
  }

  public async subscribe (key: string, callback: Callback<any>): Promise<UnsubscribeCallback> {
    let list = this.subscribes.get(key)
    if (list === undefined) {
      list = []
      this.subscribes.set(key, list)
    }

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Check the thrown message for the server-side reason and fix the underlying cause (auth, unsupported op).
  2. Verify client and hulypulse server versions are compatible so the 'info' message type is supported.
  3. Ensure any required authentication/handshake is completed before calling info().
  4. Check pulse server logs for the error returned in reply.error.

Example fix

// before
const info = await client.info() // Error: unauthorized
// after
await client.authenticate(token) // or connect with credentials first
const info = await client.info()
Defensive patterns

Strategy: try-catch

Validate before calling

if (!client.connected) await client.connect() // ensure session/auth is established before info()

Type guard

function hasError(r: { error?: string }): r is { error: string } {
  return r.error !== undefined
}

Try / catch

try {
  const info = await client.info()
} catch (e) {
  // message is the server-side error from reply.error
  console.error('hulypulse info failed:', e.message)
  if (/unauthorized|auth/i.test(e.message)) await client.authenticate(token)
  else if (/unknown|unsupported/i.test(e.message)) console.error('client/server version mismatch')
  else throw e
}

Prevention

When it happens

Trigger: 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: '...' }.

Common situations: 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.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/f546fb3fea715ca2. Report an issue: GitHub.