odysseus-dev/odysseus · error · Error
HTTP ${res.status} ${res.statusText}${msg ? `: ${msg}` : ''}
Error message
HTTP ${res.status} ${res.statusText}${msg ? `: ${msg}` : ''} What it means
Error thrown by the hardware-fit model scan in the cookbook when GET /api/hwfit/models answers non-OK. It makes a best effort to surface the server's detail/error/message JSON field (or raw body) alongside the status and status text, so the message usually carries the real backend reason (e.g. upstream HF/OSH API failure).
Source
Thrown at static/js/cookbook-hwfit.js:853
const _fitOnly = (() => { try { return localStorage.getItem('hwfit_fit_only_v1') === '1'; } catch { return false; } })();
if (_fitOnly) params.set('fit_only', '1');
}
const endpoint = isImageMode ? `/api/hwfit/image-models?${params}` : `/api/hwfit/models?${params}`;
const res = await fetch(endpoint);
// A newer scan started while this one was in flight (user switched servers
// mid-probe) — drop this stale response so it can't clobber the new one.
if (_tk !== _hwfitFetchToken) { try { wp.destroy(); } catch {} return; }
if (!res.ok) {
const body = await res.text().catch(() => '');
let msg = '';
try {
const payload = JSON.parse(body);
msg = payload && (payload.detail || payload.error || payload.message);
} catch {
msg = body;
}
msg = typeof msg === 'string' ? msg.trim() : '';
throw new Error(`HTTP ${res.status} ${res.statusText}${msg ? `: ${msg}` : ''}`);
}
let data = await res.json();
if (_tk !== _hwfitFetchToken) { try { wp.destroy(); } catch {} return; }
if (!isImageMode && quantPref && !data.error && Array.isArray(data.models) && data.models.length === 0) {
const fallbackParams = new URLSearchParams(params);
fallbackParams.delete('quant');
const fallbackRes = await fetch(`/api/hwfit/models?${fallbackParams}`);
if (_tk !== _hwfitFetchToken) { try { wp.destroy(); } catch {} return; }
if (fallbackRes.ok) {
const fallbackData = await fallbackRes.json();
if (!fallbackData.error && Array.isArray(fallbackData.models) && fallbackData.models.length > 0) {
data = fallbackData;
const quantSel = document.getElementById('hwfit-quant');
if (quantSel) quantSel.value = '';
}
}
}
// Normalize image model fields to match LLM renderer expectations.View on GitHub (pinned to f9235ebbf1)
Solutions
- Read the ': <msg>' part of the message — it is the backend's own error text; act on it (connectivity, param validity)
- curl the same /api/hwfit/models URL with the identical query params to see the raw status/body
- If network-related, fix outbound access (DNS/proxy/firewall) on the server host
- If the quant filter caused it, relax or clear the quant preference so the non-quant fallback path is not needed
Defensive patterns
Strategy: fallback
Try / catch
try {
if (!res.ok) {
const body = await res.text().catch(() => '');
let msg = '';
try { msg = JSON.parse(body)?.detail || ''; } catch { msg = body; }
throw new Error(`HTTP ${res.status} ${res.statusText}${msg ? ': ' + String(msg).slice(0, 200) : ''}`);
}
const data = await res.json();
// ...render
} catch (e) {
if (e.name === 'AbortError') return;
renderModelScanError(e.message);
} Prevention
- Check the fetch token (_hwfitFetchToken) after every await to drop stale responses — already done, keep it
- Truncate long error bodies so HTML proxy pages don't blow up the UI
- Fall back to a no-quant query (pattern already present) before surfacing empty results
When it happens
Trigger: GET /api/hwfit/models?<params> returns 5xx because the backend cannot reach huggingface.co (offline, rate-limited, proxy blocked), 4xx for invalid params (bad quant filter, unknown hardware profile), or the body is HTML from an intermediary so msg falls back to raw text.
Common situations: No internet or corporate proxy blocks HF; quant filter so restrictive the upstream returns zero and a fallback without quant is attempted; backend dependency for model metadata changed its response shape; request raced with a new fetch (token check) leaving stale UI.
Related errors
- HTTP ${res.status}
- data.detail || data.error || `HTTP ${res.status}`
- data.error || 'scan failed'
- HTTP ${res.status}
- detail || ('HTTP ' + res.status)
AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14).
Data as JSON: /api/errors/66ab7f1b0dfb46b9.
Report an issue: GitHub.