diegosouzapw/OmniRoute · error · Error

Failed to download : HTTP

Error message

Failed to download ${url}: HTTP ${resp.status}

What it means

downloadFile() in the static Potion embedding loader: the HTTP fetch of a model artifact (vocab/model/tokenizer) from HuggingFace returned a non-2xx status; the URL and status code are included for diagnosis.

Solutions

  1. Retry the sync — transient CDN errors are common
  2. Check network egress to huggingface.co from the host
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/lib/memory/embedding/staticPotion.ts:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/cc2e9c868519d92b. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/memory/embedding/staticPotion.ts:48

  dim: number;
  vocabSize: number;
  unkIdx: number;
}

// Singleton state
let _model: PotionModel | null = null;
let _loading: Promise<PotionModel> | null = null;

/** For testing: inject a mock model, bypassing download. */
export function _injectModel(model: PotionModel | null): void {
  _model = model;
  _loading = null;
}

async function downloadFile(url: string, dest: string): Promise<void> {
  const resp = await fetch(url);
  if (!resp.ok) {
    throw new Error(`Failed to download ${url}: HTTP ${resp.status}`);
  }
  const buf = await resp.arrayBuffer();
  await fs.writeFile(dest, Buffer.from(buf));
}

async function ensureFile(filePath: string, url: string): Promise<void> {
  try {
    await fs.access(filePath);
  } catch {
    await downloadFile(url, filePath);
  }
}

/**
 * Parse safetensors format to extract the first float32 tensor.
 * Header format: 8-byte little-endian uint64 = header_len, then JSON header,
 * then raw tensor bytes.
 */

View on GitHub (pinned to a179ffed5b)