{"record":{"id":"cc2e9c868519d92b","repo":"diegosouzapw/OmniRoute","slug":"failed-to-download-url-http-resp-status","errorCode":null,"errorMessage":"Failed to download ${url}: HTTP ${resp.status}","messagePattern":"Failed to download (.+?): HTTP (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/memory/embedding/staticPotion.ts","lineNumber":48,"sourceCode":"  dim: number;\n  vocabSize: number;\n  unkIdx: number;\n}\n\n// Singleton state\nlet _model: PotionModel | null = null;\nlet _loading: Promise<PotionModel> | null = null;\n\n/** For testing: inject a mock model, bypassing download. */\nexport function _injectModel(model: PotionModel | null): void {\n  _model = model;\n  _loading = null;\n}\n\nasync function downloadFile(url: string, dest: string): Promise<void> {\n  const resp = await fetch(url);\n  if (!resp.ok) {\n    throw new Error(`Failed to download ${url}: HTTP ${resp.status}`);\n  }\n  const buf = await resp.arrayBuffer();\n  await fs.writeFile(dest, Buffer.from(buf));\n}\n\nasync function ensureFile(filePath: string, url: string): Promise<void> {\n  try {\n    await fs.access(filePath);\n  } catch {\n    await downloadFile(url, filePath);\n  }\n}\n\n/**\n * Parse safetensors format to extract the first float32 tensor.\n * Header format: 8-byte little-endian uint64 = header_len, then JSON header,\n * then raw tensor bytes.\n */","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/memory/embedding/staticPotion.ts#L30-L66","documentation":"Error \"Failed to download ${url}: HTTP ${resp.status}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/memory/embedding/staticPotion.ts:48 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":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}