earendil-works/pi · error
Hugging Face returned invalid model details
Error message
Hugging Face returned invalid model details
What it means
Error "Hugging Face returned invalid model details" thrown in earendil-works/pi.
Source
Thrown at packages/coding-agent/src/extensions/llama/huggingface.ts:122
sort: "downloads",
direction: "-1",
limit: "20",
});
const payload = await this.request(`/api/models?${params}`, signal);
if (!Array.isArray(payload)) throw new Error("Hugging Face returned invalid search results");
return payload.flatMap((value) => {
if (typeof value !== "object" || value === null || typeof (value as { id?: unknown }).id !== "string")
return [];
const model = value as { id: string; downloads?: unknown };
return [{ id: model.id, downloads: typeof model.downloads === "number" ? model.downloads : 0 }];
});
}
async details(id: string, signal?: AbortSignal): Promise<HuggingFaceModelDetails> {
const encodedId = id.split("/").map(encodeURIComponent).join("/");
const payload = await this.request(`/api/models/${encodedId}?blobs=true`, signal);
if (typeof payload !== "object" || payload === null) {
throw new Error("Hugging Face returned invalid model details");
}
const model = payload as { id?: unknown; gated?: unknown; siblings?: unknown };
const sizes = new Map<string, { total: number; complete: boolean }>();
if (Array.isArray(model.siblings)) {
for (const value of model.siblings) {
if (typeof value !== "object" || value === null) continue;
const file = value as { rfilename?: unknown; size?: unknown };
if (typeof file.rfilename !== "string" || !file.rfilename.toLowerCase().endsWith(".gguf")) continue;
const filename = file.rfilename.split("/").at(-1)!;
if (filename.toLowerCase().startsWith("mmproj")) continue;
const stem = filename.slice(0, -5).replace(SHARD_SUFFIX_PATTERN, "");
const quantization = stem.match(QUANTIZATION_PATTERN)?.[1]?.toUpperCase();
if (!quantization) continue;
const current = sizes.get(quantization) ?? { total: 0, complete: true };
if (typeof file.size === "number") current.total += file.size;
else current.complete = false;
sizes.set(quantization, current);
}View on GitHub (pinned to 4af9d21d3b)
When it happens
Trigger: Thrown at packages/coding-agent/src/extensions/llama/huggingface.ts:122 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/d8a834bf51f4d4c4.
Report an issue: GitHub.