odysseus-dev/odysseus · warning · Error

HTTP ${res.status}

Error message

HTTP ${res.status}

What it means

Error thrown when scanning a Hugging Face repo for GGUF files: GET /api/cookbook/hf-gguf-files?repo_id=... returned a non-OK status. Only the numeric status is reported. It fires before the data.ok application-level check (error 27).

Source

Thrown at static/js/cookbook.js:2404

    }
    async function _scanGgufRepo(rawValue) {
      if (!dlGgufRow || !dlGgufQuant || !dlGgufNote) return false;
      const rawRepo = _stripHfUrl(rawValue || '');
      const ollamaName = _ollamaName(rawRepo);
      const fileSplit = !ollamaName ? _splitRepoFile(rawRepo) : null;
      const split = ollamaName ? { repo: ollamaName, include: null } : (fileSplit || _splitRepoTag(rawRepo));
      const repo = split.repo || '';
      if (ollamaName || split.include || !/^[^\s/]+\/[^\s/]+$/.test(repo)) {
        _hideGgufPicker();
        return false;
      }
      dlGgufRow.style.display = 'flex';
      dlGgufQuant.innerHTML = '<option value="">Scanning...</option>';
      dlGgufQuant.dataset.repo = repo;
      dlGgufNote.textContent = '';
      try {
        const res = await fetch(`/api/cookbook/hf-gguf-files?repo_id=${encodeURIComponent(repo)}`, { credentials: 'same-origin' });
        if (!res.ok) throw new Error(`HTTP ${res.status}`);
        const data = await res.json();
        if (!data.ok) throw new Error(data.error || 'scan failed');
        if (dlGgufQuant.dataset.repo !== repo) return false;
        const files = (data.files || [])
          .map(s => String(s || ''))
          .filter(name => /\.gguf$/i.test(name));
        const byQuant = new Map();
        files.forEach(name => {
          const quant = _ggufQuantFromPath(name);
          if (!quant) return;
          if (!byQuant.has(quant)) byQuant.set(quant, []);
          byQuant.get(quant).push(name);
        });
        if (!byQuant.size) {
          _hideGgufPicker('No GGUF quants found');
          return false;
        }
        const quantRank = q => {

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. curl -i '/api/cookbook/hf-gguf-files?repo_id=<repo>' to see the status and body the UI discards
  2. Verify outbound HTTPS to huggingface.co from the server host
  3. Confirm the backend version still exposes this route (404 means route mismatch)
  4. For 504, retry — large repos can be slow on first listing (HF API caching)

Example fix

// before
if (!res.ok) throw new Error(`HTTP ${res.status}`);

// after
if (!res.ok) {
  const body = await res.text().catch(() => '');
  throw new Error(`HTTP ${res.status}: ${body.slice(0, 160)}`);
}
Defensive patterns

Strategy: retry

Validate before calling

if (!/^[^\s/]+\/[^\s/]+$/.test(repo)) return false; // already guarded upstream — keep it

Try / catch

try {
  const res = await fetch(`/api/cookbook/hf-gguf-files?repo_id=${encodeURIComponent(repo)}`, { credentials: 'same-origin' });
  if (!res.ok) {
    if (res.status >= 500 || res.status === 429) { await new Promise(r => setTimeout(r, 1500)); return loadGgufPicker(rawRepo, fileSplit, true /*retried*/); }
    const body = await res.text().catch(() => '');
    throw new Error(`HTTP ${res.status}: ${body.slice(0, 160)}`);
  }
  const data = await res.json();
  if (!data.ok) throw new Error(data.error || 'scan failed');
  // ...
} catch (e) {
  dlGgufNote.textContent = e.message;
  _hideGgufPicker();
}

Prevention

When it happens

Trigger: GET /api/cookbook/hf-gguf-files returns 422 (repo_id missing), 404 (route typo after backend update), 502/504 (proxy timeout while listing large repos), or 500 (backend exception calling the HF API).

Common situations: HF hub unreachable from the server (offline/proxy/rate limit surfacing as 500); repo id contains characters that break the query string (already encoded here, but custom deployments may double-decode); backend route renamed between versions; slow repo listing exceeding a gateway timeout.

Related errors


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/70f973f14c02c0bf. Report an issue: GitHub.