ComposioHQ/composio · warning · Error

Failed to unsubscribe from triggers: ${errorMessage}

Error message

Failed to unsubscribe from triggers: ${errorMessage}

What it means

Catch-all wrapper for failures in triggerUnsubscribe; the underlying message is appended. Usually wraps error 407 (client not initialized) or a pusher-js unsubscribe exception on a dead connection.

Source

Thrown at ts/packages/core/src/utils/pusher.ts:283

      logger.info(`Subscribed to triggers. You should start receiving events now.`);
    } catch (error: unknown) {
      const errorMessage = error instanceof Error ? error.message : String(error);
      logger.error('Failed to subscribe to triggers:', error);
      throw new Error(`Failed to subscribe to triggers: ${errorMessage}`);
    }
  }

  static triggerUnsubscribe(clientId: string): void {
    try {
      if (!PusherUtils.pusherClient) {
        throw new Error('Pusher client not initialized');
      }
      PusherUtils.pusherClient.unsubscribe(`private-${clientId}_triggers`);
      logger.info('Successfully unsubscribed from triggers');
    } catch (error: unknown) {
      const errorMessage = error instanceof Error ? error.message : String(error);
      logger.error('Failed to unsubscribe from triggers:', error);
      throw new Error(`Failed to unsubscribe from triggers: ${errorMessage}`);
    }
  }
}

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Check the appended underlying message
  2. Skip unsubscribe when the client is uninitialized or the connection is already closed (idempotent teardown)
  3. Wrap teardown in a best-effort try/catch that logs rather than throws during shutdown

Example fix

// before
PusherUtils.triggerUnsubscribe(clientId);

// after
try {
  PusherUtils.triggerUnsubscribe(clientId);
} catch {
  // best-effort teardown; connection already gone
}
Defensive patterns

Strategy: fallback

Validate before calling

if (PusherUtils.pusherClient) {
  PusherUtils.triggerUnsubscribe(clientId);
}

Try / catch

try {
  PusherUtils.triggerUnsubscribe(clientId);
} catch {
  // already disconnected; safe to ignore during shutdown
}

Prevention

When it happens

Trigger: Calling triggerUnsubscribe when the client is missing (407) or when the underlying websocket has already disconnected and unsubscribe throws.

Common situations: Cleanup paths racing with disconnects; teardown during process shutdown after the connection dropped.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/a06989a7831507b2. Report an issue: GitHub.