ruvnet/ruflo · error

Unknown GGUF array element type

Error message

Unknown GGUF array element type: ${elemType}

What it means

When readGgufValue encounters an ARRAY value it reads each element via readScalar(elemType), whose switch covers GgufValueType 0-12 (UINT8 through FLOAT64). An element type outside that set — a newer GGUF type code, or garbage read because the buffer is misaligned — makes readScalar return undefined and this error throws.

Solutions

  1. Inspect the file with an up-to-date external tool (e.g. llama.cpp gguf dump) to see which type code it uses
  2. Upgrade @claude-flow/cli to a build whose GgufValueType enum covers the new type
  3. Reconvert the model with a current, standard GGUF conversion tool
  4. On failure, reject the whole model rather than continuing — later fields will be misaligned anyway
Defensive patterns

Strategy: try-catch

Try / catch

try { meta = await parseGgufHeader(path); }
catch (e) { if (e instanceof Error && e.message.includes('array element type')) { reportUnsupportedModel(path); } else throw e; }

Prevention

When it happens

Trigger: A GGUF file using an array element type added after this parser was written (code >12); element-type bytes misread after an earlier field desynchronized the reader; corrupted metadata blocks.

Common situations: New llama.cpp GGUF revisions introducing additional value types; models from third-party converters with non-standard encodings; truncated headers leaving the reader mid-field.

Related errors


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

Appendix: source

Thrown at v3/@claude-flow/cli/src/appliance/gguf-engine.ts:136

    case GgufValueType.BOOL:    return reader.readBool();
    case GgufValueType.STRING:  return reader.readString();
    case GgufValueType.UINT64:  return Number(reader.readU64());
    case GgufValueType.INT64:   return Number(reader.readI64());
    case GgufValueType.FLOAT64: return reader.readF64();
    default: return undefined;
  }
}

/** Read a single GGUF typed value (scalar or array) from the buffer. */
function readGgufValue(reader: BufferReader): unknown {
  const valueType = reader.readU32();
  if (valueType === GgufValueType.ARRAY) {
    const elemType = reader.readU32();
    const len = reader.readU64AsNumber();
    const arr: unknown[] = [];
    for (let i = 0; i < len; i++) {
      const v = readScalar(reader, elemType);
      if (v === undefined) throw new Error(`Unknown GGUF array element type: ${elemType}`);
      arr.push(v);
    }
    return arr;
  }
  const v = readScalar(reader, valueType);
  if (v === undefined) throw new Error(`Unknown GGUF value type: ${valueType}`);
  return v;
}

// ── GGUF Header Parsing ─────────────────────────────────────

/**
 * Parse the header and metadata from a GGUF file without loading tensors.
 * Reads only the first 256 KB of the file.
 */
export async function parseGgufHeader(path: string): Promise<GgufMetadata> {
  const fileInfo = await fsStat(path);
  const readSize = Math.min(fileInfo.size, 256 * 1024);

View on GitHub (pinned to fa13ee4ad6)