ruvnet/ruflo · error

Dimension mismatch: expected ${this.dimensions}, got ${embed

Error message

Dimension mismatch: expected ${this.dimensions}, got ${embedding.length}

What it means

Thrown when a cached embedding's length differs from the cache's configured dimensions. Defense: fix the dimension per cache instance at creation and reject mismatched inserts with both values in the message.

Source

Thrown at v3/@claude-flow/embeddings/src/rvf-embedding-cache.ts:183

    // Update LRU tracking
    entry.accessedAt = now;
    entry.accessCount++;
    this.dirty = true;

    return entry.embedding;
  }

  /**
   * Store an embedding in the cache.
   * Triggers LRU eviction if the cache exceeds maxSize.
   */
  async set(text: string, embedding: Float32Array): Promise<void> {
    await this.ensureInitialized();

    // Validate dimensions if configured
    if (this.dimensions !== undefined && embedding.length !== this.dimensions) {
      throw new Error(
        `Dimension mismatch: expected ${this.dimensions}, got ${embedding.length}`
      );
    }

    const hash = this.hashText(text);
    const now = Date.now();

    // Copy the embedding to avoid external mutation
    const copy = new Float32Array(embedding.length);
    copy.set(embedding);

    const existing = this.entries.get(hash);
    if (existing) {
      existing.embedding = copy;
      existing.accessedAt = now;
      existing.accessCount++;
    } else {
      this.entries.set(hash, {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Store only embeddings of the configured dimension; recreate the cache if the model changed.
  2. Set dimensions in the cache config to match the embedding model output size.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/@claude-flow/embeddings/src/rvf-embedding-cache.ts:183 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/f2f4b9780833eb6c. Report an issue: GitHub.