ruvnet/RuView · error · Error

Invalid stream options: ${validationResult.errors.join(', ')

Error message

Invalid stream options: ${validationResult.errors.join(', ')}

What it means

startPoseStream validates its options via validateStreamOptions (ui/services/pose.service.js:200) and throws one Error joining all violations. The rules: `zoneIds`, if provided, must be an array; `minConfidence` must be a number in [0,1]; `maxFps` must be a number greater than 0 and at most 60. All violations are reported together, comma-separated.

Source

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

  // Get pose statistics
  async getStats(hours = 24) {
    return apiService.get(API_CONFIG.ENDPOINTS.POSE.STATS, { hours });
  }

  // Start pose stream
  async startPoseStream(options = {}) {
    if (this.streamConnection) {
      this.logger.warn('Pose stream already active', { connectionId: this.streamConnection });
      return this.streamConnection;
    }

    this.logger.info('Starting pose stream', { options });
    this.resetPerformanceMetrics();

    // Validate options
    const validationResult = this.validateStreamOptions(options);
    if (!validationResult.valid) {
      throw new Error(`Invalid stream options: ${validationResult.errors.join(', ')}`);
    }

    // Use a lower confidence threshold when model inference is active
    const defaultThreshold = this.modelActive
      ? this.config.confidenceThresholdModelInference
      : this.config.confidenceThreshold;

    const params = {
      zone_ids: options.zoneIds?.join(','),
      min_confidence: options.minConfidence || defaultThreshold,
      max_fps: options.maxFps || 30,
      token: options.token || apiService.authToken
    };

    // Remove undefined values
    Object.keys(params).forEach(key => 
      params[key] === undefined && delete params[key]
    );

View on GitHub (pinned to 4685618388)

Solutions

  1. Pass fractions for confidence: { minConfidence: 0.75 } not 75.
  2. Pass zone ids as an array: { zoneIds: ['kitchen', 'hall'] } not 'kitchen,hall'.
  3. Clamp fps to the supported range: { maxFps: Math.min(60, Math.max(1, fps)) }.

Example fix

// before
poseService.startPoseStream({ zoneIds: selectedZones.join(','), minConfidence: 75, maxFps: 120 });
// after
poseService.startPoseStream({ zoneIds: selectedZones, minConfidence: 0.75, maxFps: 30 });
Defensive patterns

Strategy: validation

Validate before calling

const errors = [];
if (options.zoneIds !== undefined && !Array.isArray(options.zoneIds)) errors.push('zoneIds must be an array');
if (options.minConfidence !== undefined && (typeof options.minConfidence !== 'number' || options.minConfidence < 0 || options.minConfidence > 1)) errors.push('minConfidence must be 0..1');
if (options.maxFps !== undefined && (typeof options.maxFps !== 'number' || options.maxFps <= 0 || options.maxFps > 60)) errors.push('maxFps must be 1..60');
if (errors.length === 0) await poseService.startPoseStream(options);

Type guard

function isPoseStreamOptions(o) {
  return (o.zoneIds === undefined || Array.isArray(o.zoneIds))
    && (o.minConfidence === undefined || (typeof o.minConfidence === 'number' && o.minConfidence >= 0 && o.minConfidence <= 1))
    && (o.maxFps === undefined || (typeof o.maxFps === 'number' && o.maxFps > 0 && o.maxFps <= 60));
}

Try / catch

try {
  await poseService.startPoseStream(options);
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Invalid stream options')) {
    // message lists every violated field; fix them, then retry once
    throw new Error(`stream options rejected: ${e.message}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: startPoseStream({ zoneIds: 'kitchen' }) (string instead of array); { minConfidence: 75 } (percent instead of 0..1 fraction); { maxFps: 0 } or { maxFps: 120 }; { minConfidence: '0.5' } (string).

Common situations: UI sliders emitting 0–100 confidence values; joining zone ids into a comma-separated string before passing; requesting >60 fps for smoother playback when the API caps at 60; string values from URL/form params.

Related errors


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