ruvnet/ruflo · error · Error
Unknown GGUF array element type: ${elemType}
Error message
Unknown GGUF array element type: ${elemType} What it means
Thrown while reading a GGUF array value: the element type code (readGgufValue encountered valueType === ARRAY, then read the element type as elemType) is not one of the cases handled by readScalar, which returns undefined for unknown types. This indicates either an unknown/extended GGUF value type or buffer corruption causing a garbage type code.
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 6b01dc5a68)
Solutions
- Confirm the file parses with a reference GGUF reader (llama.cpp) to distinguish corruption from an unsupported type.
- If the type is legitimate but unsupported, extend readScalar's switch to handle the new GgufValueType and add it to the enum.
- Re-download the model to rule out transfer corruption.
- For non-critical metadata, the parseGgufBuffer KV loop already try/catches per-entry, so partial metadata can still be usable if the unknown array is in a non-essential key.
Example fix
// before
// readScalar returns undefined for unsupported elemType
// after
function readScalar(reader: BufferReader, t: number): unknown {
switch (t) {
case GgufValueType.UINT8: return reader.readU8();
// ... existing cases ...
case NEW_TYPE_BOOL: return reader.readBool();
default: return undefined;
}
} Defensive patterns
Strategy: fallback
Validate before calling
// No pre-check is possible for an unknown type; instead validate the file with a // reference reader and, if a known-unsupported type is expected, extend readScalar.
Type guard
function isKnownValueType(t: number): boolean {
return Object.values(GgufValueType).includes(t as GgufValueType);
} Try / catch
try {
return await parseGgufHeader(path);
} catch (e) {
if (e instanceof Error && /Unknown GGUF array element type/.test(e.message)) {
logger.warn({ path }, 'unsupported array type; some metadata unavailable');
}
throw e;
} Prevention
- Use GGUF files produced by current tooling.
- Extend readScalar when adopting a newer GGUF spec.
- Validate files with llama.cpp first.
- Re-download to rule out corruption.
When it happens
Trigger: Parsing a GGUF whose metadata contains an array whose element type is outside the implemented GgufValueType set (e.g. a newer spec type the parser does not yet support), or a corrupted buffer where the element-type u32 is random.
Common situations: A GGUF produced by tooling that emits a value type this parser does not recognize (spec drift / newer GGUF revision); file corruption from an interrupted download; reading a non-GGUF file whose bytes happen to pass the magic check.
Related errors
- String length ${len} exceeds remaining buffer
- Unknown GGUF value type: ${valueType}
- Invalid GGUF magic: 0x${magic.toString(16)} (expected 0x${GG
- Unsupported GGUF version: ${version} (expected 2 or 3)
- No KV cache output path specified
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/ac14fd2af83368ab.
Report an issue: GitHub.