can1357/oh-my-pi · error · Error
Failed to download ${model} ${fileName} from ${repo}: ${resp
Error message
Failed to download ${model} ${fileName} from ${repo}: ${response.status} ${response.statusText} What it means
ensureFastembedModelSidecars downloads missing model sidecar files (tokenizer/config) from Hugging Face and throws if any fetch returns a non-OK status, embedding the model, filename, repo, and HTTP status in the message. This is the sidecar-heal path for the local fastembed model cache.
Source
Thrown at packages/mnemopi/src/core/fastembed-model-cache.ts:32
"fast-bge-small-en": "BAAI/bge-small-en",
"fast-bge-small-en-v1.5": "BAAI/bge-small-en-v1.5",
"fast-bge-small-zh-v1.5": "BAAI/bge-small-zh-v1.5",
"fast-multilingual-e5-large": "intfloat/multilingual-e5-large",
};
/** Download missing config/tokenizer sidecars into a fastembed model cache directory. */
export async function ensureFastembedModelSidecars(model: string, cacheDir = "local_cache"): Promise<boolean> {
const repo = FASTEMBED_HF_REPOS[model];
if (repo === undefined) return false;
const modelDir = path.join(cacheDir, model);
for (const fileName of FASTEMBED_MODEL_SIDECARS) {
const target = path.join(modelDir, fileName);
if (await Bun.file(target).exists()) continue;
const response = await fetch(`https://huggingface.co/${repo}/resolve/main/${fileName}`);
if (!response.ok) {
throw new Error(
`Failed to download ${model} ${fileName} from ${repo}: ${response.status} ${response.statusText}`,
);
}
await Bun.write(target, await response.arrayBuffer());
}
return true;
}
View on GitHub (pinned to 9690622007)
Solutions
- Pre-populate the model cache directory with all FASTEMBED_MODEL_SIDECARS files (copy from another machine) so no download is attempted.
- Set a HF token if the repo is gated/rate-limited, or use an HF mirror endpoint if available.
- Check the exact HTTP status in the message: 404 → repo/model renamed, update the fastembed package; 429 → retry later with backoff.
- Verify network/proxy access to huggingface.co from the deployment environment.
Example fix
// before // partial cache: model.onnx exists, tokenizer.json missing → runtime download fails offline // after // provision offline: // cp ~/.cache/fastembed/<model>/tokenizer.json /app/.cache/fastembed/<model>/ await initWithSidecarHeal(); // now no fetch needed
Defensive patterns
Strategy: fallback
Validate before calling
for (const f of FASTEMBED_MODEL_SIDECARS) {
if (!(await Bun.file(path.join(modelDir, f)).exists())) {
throw new Error(`Cache incomplete before offline init: missing ${f}`);
}
} Try / catch
try {
await initWithSidecarHeal();
} catch (e) {
if (e instanceof Error && e.message.startsWith("Failed to download")) {
// fall back to a non-sidecar embedding path or fail with setup instructions
} else throw e;
} Prevention
- Pre-download all sidecars into the cache at deploy time (Docker build step).
- Monitor the HTTP status in the message: 404 means the repo moved — upgrade fastembed.
- Set HF auth token for gated repos and handle 429 with backoff.
- Verify egress to huggingface.co in locked-down environments.
When it happens
Trigger: Initializing fastembed when a sidecar file is absent locally and `https://huggingface.co/<repo>/resolve/main/<file>` returns 401/403 (rate limit or gated repo), 404 (file/repo moved), or 5xx.
Common situations: Offline/air-gapped environments with a partial cache, Hugging Face rate limiting (429) anonymous downloads, model repos renamed or made gated, corporate proxies blocking huggingface.co.
Related errors
- Failed to download ${filename} (${repo}): HTTP ${response.st
- Browser download failed (${response.status} ${response.statu
- V2 remote compaction failed (${response.status} ${response.s
- sso-role
- HTTP request failed. status=${response.status}; url=${url};
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/7b2733967b7a6dd0.
Report an issue: GitHub.