pbakaus/impeccable · warning · Error
source read failed: ${r.status}
Error message
source read failed: ${r.status} What it means
Thrown inside the completed-session source check when the GET of the source file from the engine server returns a non-OK status. The script reads the source to confirm the session's variant wrapper is still present; a failed read triggers the retry/fallback path that warns and keeps the session open rather than closing it. The error text prefixes the status with 'source read failed:'.
Source
Thrown at skill/scripts/live-browser.js:6269
// picker replaces it), so it needs evidence that the wrapper is gone: a
// read that answers without the marker, or a 404 (the file itself was
// renamed or deleted). Either kind retries on the shared budget first.
// A read that fails for any other reason (the server briefly away, a
// transient fetch error) says nothing about the wrapper; after the budget
// the session is kept, the user told, and the next event retries.
const onNoWrapper = (reason) => {
if (!stillActive()) return;
if (attempt < COMPLETED_SOURCE_FALLBACK_RETRIES) { retryLater(); return; }
discardOrphanedSession(reason);
};
const onUnreadable = (detail) => {
if (!stillActive()) return;
if (attempt < COMPLETED_SOURCE_FALLBACK_RETRIES) { retryLater(); return; }
console.warn('[impeccable] Could not read source to check the variant wrapper; keeping the session: ' + detail);
showToast('Could not read the source file to check this session; it stays open and is checked again on the next event.', 5500);
};
fetch(url)
.then(r => { if (!r.ok) throw new Error('source read failed: ' + r.status); return r.text(); })
.then(text => {
if (!stillActive()) return;
if (sourceHasSessionWrapper(text, sessionId)) return;
onNoWrapper('variant wrapper missing from source');
})
.catch(err => {
const detail = err && err.message ? err.message : 'fetch failed';
if (/source read failed: 404$/.test(detail)) {
onNoWrapper('source file missing (404) while checking for the variant wrapper');
return;
}
onUnreadable(detail);
});
}
function completeSourceInjection(wrapper, sessionId, opts) {
recoveryWaitingForAnchor = false;
if (pendingVariantAnchorRetryObserver) {View on GitHub (pinned to 2bc2879276)
Solutions
- Check the numeric status in the thrown error/console warning: 404 → locate where the file moved and reopen the session against the new path; 401/403 → reload the tab to refresh the token
- Verify the dev server is still running on PORT
- Keep the session open as designed — it is re-checked on the next event; the wrapper may be verified after the file is restored
- Restore or republish the source file containing the impeccable-variants wrapper for the sessionId
Defensive patterns
Strategy: fallback
Try / catch
fetch(url)
.then(r => { if (!r.ok) throw new Error('source read failed: ' + r.status); return r.text(); })
.catch(err => {
console.warn('[impeccable] source check failed, keeping session:', err.message);
showToast('Session stays open; it will be re-checked on the next event.', 5500);
}); Prevention
- Rely on the built-in retry/fallback: failed reads keep the session and re-check on the next event
- Avoid renaming or deleting session source files while a completed session is open
- Reload the tab after dev-server restarts to refresh the token before interacting
- Monitor the warning text — a persistent 'source read failed: 404' means the wrapper file is truly gone
When it happens
Trigger: fetch(url) of the session's source file resolves with r.ok === false after exhausting COMPLETED_SOURCE_FALLBACK_RETRIES — e.g. 404 because the source file was renamed or deleted, or 401/403 from a stale token.
Common situations: File moved/refactored while a completed session was still open; dev server restart invalidating TOKEN; transient localhost fetch failure on the last retry attempt.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- ${String(res.status)}
- errBody.error || ('HTTP ' + res.status)
- HTTP ${res.status}
- ${r.status}
- TypeError: fetch failed: {}
AI-assisted analysis of pbakaus/impeccable@2bc2879276 (2026-09-08).
Data as JSON: /api/errors/1f37e68d58301c1e.
Report an issue: GitHub.