{"record":{"id":"ac5dc34eabca10bd","repo":"earendil-works/pi","slug":"hugging-face-returned-http-response-status","errorCode":null,"errorMessage":"Hugging Face returned HTTP ${response.status}","messagePattern":"Hugging Face returned HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/extensions/llama/huggingface.ts","lineNumber":95,"sourceCode":"\t\t\theaders,\n\t\t\tsignal: signal ? AbortSignal.any([signal, timeout]) : timeout,\n\t\t});\n\t\tlet payload: unknown;\n\t\ttry {\n\t\t\tpayload = await response.json();\n\t\t} catch {\n\t\t\tpayload = undefined;\n\t\t}\n\t\tif (!response.ok) {\n\t\t\tconst fallback = `Hugging Face returned HTTP ${response.status}`;\n\t\t\tif (response.status === 429) {\n\t\t\t\tconst delay =\n\t\t\t\t\tNumber(response.headers.get(\"retry-after\")) || parseRateLimitDelay(response.headers.get(\"ratelimit\"));\n\t\t\t\tthrow new Error(\n\t\t\t\t\tdelay ? `Hugging Face rate limit reached; retry in ${delay}s` : \"Hugging Face rate limit reached\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new Error(payloadError(payload, fallback));\n\t\t}\n\t\treturn payload;\n\t}\n\n\tasync search(query: string, signal?: AbortSignal): Promise<HuggingFaceModel[]> {\n\t\tconst params = new URLSearchParams({\n\t\t\tsearch: query,\n\t\t\tfilter: \"gguf\",\n\t\t\tsort: \"downloads\",\n\t\t\tdirection: \"-1\",\n\t\t\tlimit: \"20\",\n\t\t});\n\t\tconst payload = await this.request(`/api/models?${params}`, signal);\n\t\tif (!Array.isArray(payload)) throw new Error(\"Hugging Face returned invalid search results\");\n\t\treturn payload.flatMap((value) => {\n\t\t\tif (typeof value !== \"object\" || value === null || typeof (value as { id?: unknown }).id !== \"string\")\n\t\t\t\treturn [];\n\t\t\tconst model = value as { id: string; downloads?: unknown };","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/extensions/llama/huggingface.ts#L77-L113","documentation":"Error \"Hugging Face returned HTTP ${response.status}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/coding-agent/src/extensions/llama/huggingface.ts:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}