ruvnet/RuView · warning · Error

No active stream connection to reconnect

Error message

No active stream connection to reconnect

What it means

poseService.reconnectStream() only works when this.streamConnection is set — i.e. a stream was previously started via startPoseStream() and has not been stopped. stopPoseStream() nulls the handle, and a never-started service also has it null, so calling reconnect() in either state throws this Error immediately.

Source

Thrown at ui/services/pose.service.js:707

        lastUpdate: this.performanceMetrics.lastUpdateTime,
        messageCount: this.performanceMetrics.messageCount,
        errorCount: this.performanceMetrics.errorCount,
        apiHealthy: !!stats
      };
    } catch (error) {
      return {
        healthy: false,
        error: error.message,
        connectionState: this.connectionState,
        lastUpdate: this.performanceMetrics.lastUpdateTime
      };
    }
  }

  // Force reconnection
  async reconnectStream() {
    if (!this.streamConnection) {
      throw new Error('No active stream connection to reconnect');
    }

    this.logger.info('Forcing stream reconnection');
    
    // Get current connection stats to preserve options
    const stats = wsService.getConnectionStats(this.streamConnection);
    if (!stats) {
      throw new Error('Cannot get connection stats for reconnection');
    }

    // Extract original options from URL parameters
    const url = new URL(stats.url);
    const params = Object.fromEntries(url.searchParams);
    
    const options = {
      zoneIds: params.zone_ids ? params.zone_ids.split(',') : undefined,
      minConfidence: params.min_confidence ? parseFloat(params.min_confidence) : undefined,
      maxFps: params.max_fps ? parseInt(params.max_fps) : undefined,

View on GitHub (pinned to 4685618388)

Solutions

  1. Guard the call and fall back to a fresh start: if (!poseService.streamConnection) return poseService.startPoseStream(lastOptions);
  2. Bind the Reconnect button's disabled state to the connection-state monitor so it is only clickable while a connection exists.
  3. In retry logic, treat this Error as 'nothing to reconnect' and route to startPoseStream with the saved options.

Example fix

// before
async function onReconnect() { await poseService.reconnectStream(); }
// after
async function onReconnect() {
  if (!poseService.streamConnection) return poseService.startPoseStream(lastStreamOptions);
  await poseService.reconnectStream();
}
Defensive patterns

Strategy: validation

Validate before calling

if (!poseService.streamConnection) {
  // nothing to reconnect — start fresh with the last known options
  return poseService.startPoseStream(lastStreamOptions ?? {});
}
await poseService.reconnectStream();

Type guard

function hasActiveStream(service) {
  return Boolean(service.streamConnection);
}

Try / catch

try {
  await poseService.reconnectStream();
} catch (e) {
  if (e instanceof Error && e.message === 'No active stream connection to reconnect') {
    return poseService.startPoseStream(lastStreamOptions ?? {});
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling reconnectStream() after stopPoseStream(); calling it from a retry loop when the original startPoseStream() itself failed; a UI 'Reconnect' button clicked before any stream ever started.

Common situations: Auto-reconnect logic that runs on page load or after connection-death handlers without checking whether a connection ever existed; button state not bound to connection state.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/0798e5f89bb9e3ce. Report an issue: GitHub.