earendil-works/pi · error
Hugging Face rate limit reached
Error message
Hugging Face rate limit reached
What it means
Rate-limit error in HuggingFaceClient.request: the API responded 429. When a retry delay could be derived from the Retry-After header or parsed ratelimit headers the message includes it; this short form means no delay header was present.
Solutions
- Wait before retrying the Hugging Face request
- Cache search/details results to reduce call volume
- Add an API token to raise the rate limit
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at packages/coding-agent/src/extensions/llama/huggingface.ts:91 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/62f7915ffe148a7c.
Report an issue: GitHub.
Appendix: source
Thrown at packages/coding-agent/src/extensions/llama/huggingface.ts:91
const headers = new Headers();
if (this.token) headers.set("Authorization", `Bearer ${this.token}`);
const timeout = AbortSignal.timeout(15_000);
const response = await fetch(`${this.baseUrl}${path}`, {
headers,
signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
});
let payload: unknown;
try {
payload = await response.json();
} catch {
payload = undefined;
}
if (!response.ok) {
const fallback = `Hugging Face returned HTTP ${response.status}`;
if (response.status === 429) {
const delay =
Number(response.headers.get("retry-after")) || parseRateLimitDelay(response.headers.get("ratelimit"));
throw new Error(
delay ? `Hugging Face rate limit reached; retry in ${delay}s` : "Hugging Face rate limit reached",
);
}
throw new Error(payloadError(payload, fallback));
}
return payload;
}
async search(query: string, signal?: AbortSignal): Promise<HuggingFaceModel[]> {
const params = new URLSearchParams({
search: query,
filter: "gguf",
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");View on GitHub (pinned to 4af9d21d3b)