paperclipai/paperclip · warning · Error
HTTP ${status}
Error message
HTTP ${status} What it means
Also from the dashboard's refresh() in the rendered HTML: after fetch('/api/state') it checks res.ok and throws 'HTTP <status>' otherwise. The thrown value is caught and shown as 'Refresh failed: HTTP <code>'. This is the generic non-OK response path; 401 (bad/missing token) and 500 are the common causes.
Source
Thrown at packages/kv-demo-mcp-server/src/render.ts:101
const rows = document.getElementById("rows");
if (!state.entries.length) {
rows.innerHTML = '<tr class="empty"><td colspan="3">No values yet — call the <code>kv_set</code> tool to add one.</td></tr>';
return;
}
rows.innerHTML = state.entries.map((entry) =>
'<tr><td class="key">' + escapeHtml(entry.key) +
'</td><td class="value">' + escapeHtml(entry.value) +
'</td><td class="updated">' + escapeHtml(entry.updatedAt) + '</td></tr>'
).join("");
}
async function refresh() {
const status = document.getElementById("status");
try {
const headers = { accept: "application/json" };
if (token) headers.authorization = "Bearer " + token;
if (TOKEN_REQUIRED && !token) throw new Error("Add #token=YOUR_TOKEN to this URL");
const res = await fetch("/api/state", { headers });
if (!res.ok) throw new Error("HTTP " + res.status);
render(await res.json());
status.textContent = "Auto-refreshing every 2s.";
} catch (err) {
status.textContent = "Refresh failed: " + err.message;
}
}
setInterval(refresh, 2000);
</script>
</body>
</html>`;
}
View on GitHub (pinned to 67001ec6eb)
Solutions
- If status is 401, correct the #token= fragment (see error 446).
- If status is 500, inspect the server logs for the underlying store error.
- Confirm the dashboard URL host/port still match the running server.
Example fix
// status element shows: Refresh failed: HTTP 401 // fix: update URL fragment https://host:8848/#token=<correct-token>
Defensive patterns
Strategy: try-catch
Try / catch
try { const r = await fetch('/api/state', { headers }); if (!r.ok) throw new Error('HTTP '+r.status); ... }
catch (e) {
if (/HTTP 401/.test(e.message)) { /* fix token */ } else if (/HTTP 5\d\d/.test(e.message)) { /* surface server error */ } else throw e;
} Prevention
- On 401, verify the #token= fragment matches the server-configured token.
- On 5xx, check server logs before retrying.
- Do not retry blindly on 4xx — the request is malformed/forbidden.
When it happens
Trigger: The /api/state request returns a non-2xx status — most often 401 when the token in the URL hash is wrong/expired, or 500 from a server-side store error.
Common situations: Wrong token in the fragment; token auth enabled server-side and the request was sent without/with-stale Authorization header; server crash or store corruption returning 500.
Related errors
- Add #token=YOUR_TOKEN to this URL
- API error ${response.status}: ${bytes.toString("utf8")}
- Request body too large.
- exe.dev API command failed (${response.status}) for: ${logCo
- Request failed: ${response.status}
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/9b0d956da40ab945.
Report an issue: GitHub.