ruvnet/ruflo · error

Sparse bridge not initialized

Error message

Sparse bridge not initialized

What it means

Guard in encodeTraces: the sparse bridge's status must be 'ready' (set during initialization) before traces can be encoded; the error fires when encodeTraces is called before a successful initialize or after destroy() reset the status to 'unloaded'.

Source

Thrown at v3/plugins/perf-optimizer/src/bridges/sparse-bridge.ts:103

  async destroy(): Promise<void> {
    this.featureHashes.clear();
    this.encodingCache.clear();
    this.status = 'unloaded';
  }

  isReady(): boolean {
    return this.status === 'ready';
  }

  /**
   * Encode traces into sparse representation
   *
   * Uses feature hashing and sparse encoding to efficiently
   * represent trace spans for downstream analysis.
   */
  async encodeTraces(spans: TraceSpan[]): Promise<Float32Array> {
    if (!this.isReady()) {
      throw new Error('Sparse bridge not initialized');
    }

    // Check cache
    const cacheKey = this.computeCacheKey(spans);
    const cached = this.encodingCache.get(cacheKey);
    if (cached) return cached;

    const encoding = new Float32Array(this.config.maxDimensions);
    const nonZeroCount = Math.floor(this.config.maxDimensions * this.config.sparsityRatio);

    for (const span of spans) {
      // Extract features from span
      const features = this.extractSpanFeatures(span);

      // Hash features to sparse dimensions
      for (const [feature, value] of Object.entries(features)) {
        const hash = this.hashFeature(feature);
        const dim = hash % this.config.maxDimensions;

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Ensure the module/bridge/plugin initialize() method has been called and awaited before invoking this operation.
  2. Guard against calls made during startup: await the initialization promise or check the initialized flag and fail fast with a clear setup hint.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at v3/plugins/perf-optimizer/src/bridges/sparse-bridge.ts:103 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/78d5f93a9a38e991. Report an issue: GitHub.