ruvnet/ruflo · error

[rvf-embedding-cache] Invalid magic bytes, skipping load

Error message

[rvf-embedding-cache] Invalid magic bytes, skipping load

What it means

Log warning in loadFromFile: the cache file's header magic bytes do not match the expected rvf cache format (wrong or corrupt file), so the whole file is skipped and the cache starts empty.

Source

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

   * Load entries from the binary cache file.
   */
  private loadFromFile(): void {
    try {
      const fileBuffer = readFileSync(this.cachePath);
      if (fileBuffer.length < MAGIC.length) return;

      const buffer = fileBuffer.buffer.slice(
        fileBuffer.byteOffset,
        fileBuffer.byteOffset + fileBuffer.byteLength
      );
      const view = new DataView(buffer);
      const bytes = new Uint8Array(buffer);
      let offset = 0;

      // Verify magic
      for (let i = 0; i < MAGIC.length; i++) {
        if (bytes[offset + i] !== MAGIC[i]) {
          console.warn('[rvf-embedding-cache] Invalid magic bytes, skipping load');
          return;
        }
      }
      offset += MAGIC.length;

      // Check for version header (v2+)
      let formatVersion = 1;
      if (offset + 4 <= buffer.byteLength) {
        const possibleVersion = view.getUint32(offset, true);
        if (possibleVersion === 2) {
          formatVersion = possibleVersion;
          offset += 4;
        }
      }

      // Read entries
      while (offset + 8 <= buffer.byteLength) {
        // Need at least 4 (hash) + 4 (dims) = 8 bytes for the header

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Delete the cache file so it is regenerated; invalid magic bytes indicate a corrupt or wrong-format cache file.
Defensive patterns

Strategy: validation

When it happens

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