{"record":{"id":"f2f4b9780833eb6c","repo":"ruvnet/ruflo","slug":"dimension-mismatch-expected-this-dimensions-g","errorCode":null,"errorMessage":"Dimension mismatch: expected ${this.dimensions}, got ${embedding.length}","messagePattern":"Dimension mismatch: expected (.+?), got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/embeddings/src/rvf-embedding-cache.ts","lineNumber":183,"sourceCode":"\n    // Update LRU tracking\n    entry.accessedAt = now;\n    entry.accessCount++;\n    this.dirty = true;\n\n    return entry.embedding;\n  }\n\n  /**\n   * Store an embedding in the cache.\n   * Triggers LRU eviction if the cache exceeds maxSize.\n   */\n  async set(text: string, embedding: Float32Array): Promise<void> {\n    await this.ensureInitialized();\n\n    // Validate dimensions if configured\n    if (this.dimensions !== undefined && embedding.length !== this.dimensions) {\n      throw new Error(\n        `Dimension mismatch: expected ${this.dimensions}, got ${embedding.length}`\n      );\n    }\n\n    const hash = this.hashText(text);\n    const now = Date.now();\n\n    // Copy the embedding to avoid external mutation\n    const copy = new Float32Array(embedding.length);\n    copy.set(embedding);\n\n    const existing = this.entries.get(hash);\n    if (existing) {\n      existing.embedding = copy;\n      existing.accessedAt = now;\n      existing.accessCount++;\n    } else {\n      this.entries.set(hash, {","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/embeddings/src/rvf-embedding-cache.ts#L165-L201","documentation":"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.","triggerScenarios":"Thrown at v3/@claude-flow/embeddings/src/rvf-embedding-cache.ts:183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Store only embeddings of the configured dimension; recreate the cache if the model changed.","Set dimensions in the cache config to match the embedding model output size."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}