gildas-lormeau/SingleFile · error · Error
(response.statusText || ("Error " + response.status)) + " (W
Error message
(response.statusText || ("Error " + response.status)) + " (Woleet)" What it means
The Woleet anchoring client wraps API calls and throws an Error combining the HTTP statusText (or a fallback 'Error <status>') with the ' (Woleet)' suffix whenever the API responds with status >= 400. Status 402 is special-cased first to give a credits-exhausted message with a recharge link. This generic branch covers all other client/server errors returned by the Woleet API.
Source
Thrown at src/lib/woleet/woleet.js:53
"Content-Type": "application/json",
"Authorization": "Bearer " + bearer
},
body: JSON.stringify({
"name": hash,
"hash": hash,
"public": true
})
});
if (response.status == 401) {
const error = new Error("Your access token on Woleet is invalid. Go to __DOC_LINK__ to create your account.");
error.link = "https://app.woleet.io/";
throw error;
} else if (response.status == 402) {
const error = new Error("You have no more credits on Woleet. Go to __DOC_LINK__ to recharge them.");
error.link = "https://app.woleet.io/";
throw error;
} else if (response.status >= 400) {
throw new Error((response.statusText || ("Error " + response.status)) + " (Woleet)");
}
return response.json();
}View on GitHub (pinned to 517fb7c5cf)
Solutions
- Inspect the statusText in the message to identify the cause; log the full error including the numeric status fallback.
- Refresh or regenerate the Woleet API token if status is 401/403.
- Validate the anchor payload (digest, anchor id) matches the Woleet API schema if status is 400.
- If status is 429 or 5xx, retry with exponential backoff; check Woleet service status for outages.
Example fix
// before
await woleet.anchor(digest); // 'Unauthorized (Woleet)' from stale token
// after
if (!woleetTokenIsValid()) token = await refreshWoleetToken();
try {
await woleet.anchor(digest);
} catch (e) {
if (e.message.includes('429')) await sleep(backoff) /* then retry */;
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Validate preconditions before calling the Woleet API
if (!apiKey) throw new Error('Woleet API token missing');
if (!/^[0-9a-f]{64}$/i.test(digest)) throw new Error('Invalid digest format for Woleet anchor'); Type guard
function isWoleetApiError(e) {
return e instanceof Error && e.message.endsWith('(Woleet)');
}
function woleetStatus(e) {
const m = /Error (\d{3}) \(Woleet\)$/.exec(e.message);
return m ? Number(m[1]) : null;
} Try / catch
try {
await woleet.anchor(digest);
} catch (e) {
if (isWoleetApiError(e)) {
const s = woleetStatus(e);
if (s === 401 || s === 403) { await rotateToken(); return retry(); }
if (s === 429 || s >= 500) { await backoff(); return retry(); }
if (s === 402) { /* special-cased upstream: surface recharge link */ }
}
throw e;
} Prevention
- Keep the Woleet API token fresh; rotate before expiry.
- Validate digests and payload shape against the Woleet API docs before calls.
- Implement exponential backoff for 429/5xx instead of failing fast.
- Watch credits balance separately so 402 (credits exhausted) is handled via its dedicated message/link.
When it happens
Trigger: anchor() (or the shared request helper it flows through) receives a Woleet API response with status >= 400 that is not 402 and not handled by an earlier branch, e.g. 400 bad payload, 401/403 invalid API token, 404 unknown anchor id, 429 rate-limited, or 5xx server error.
Common situations: Expired or revoked Woleet API token (401/403); malformed anchor request body (400); exceeding API rate limits (429); Woleet service outage or maintenance returning 5xx; using a deprecated API endpoint after a Woleet version change.
AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01).
Data as JSON: /api/errors/738b37dfa59da050.
Report an issue: GitHub.