{"record":{"id":"c525f1550a896f25","repo":"pbakaus/impeccable","slug":"string-res-status","errorCode":null,"errorMessage":"${String(res.status)}","messagePattern":"\\$\\{String\\(res\\.status\\)\\}","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skill/scripts/live-browser.js","lineNumber":5775,"sourceCode":"      try { runtime.unmount(mountedInstance); } catch { /* non-fatal */ }\n    }\n    removeSvelteComponentVariantStyle(svelteComponentSession);\n    wrapperEl.parentElement.replaceChild(committed, wrapperEl);\n    svelteComponentSession = null;\n    svelteRuntimePromise = null;\n    selectedElement = committed;\n    return true;\n  }\n\n  async function injectSvelteComponentsFromManifest(manifestPath, sessionId) {\n    // Every (re)injection is a fresh attempt: reset the failure dedupe so a\n    // republish that is STILL broken at the same URL reports again instead of\n    // being swallowed while the agent believes the repair landed.\n    lastReportedMountFailure = null;\n    const url = 'http://localhost:' + PORT + '/source?token=' + TOKEN + '&path=' + encodeURIComponent(manifestPath);\n    try {\n      const res = await fetch(url);\n      if (!res.ok) throw new Error(String(res.status));\n      const manifest = JSON.parse(await res.text());\n      if (manifest.id !== sessionId) {\n        // A manifest at the expected path belonging to a different session is\n        // an agent-side publish error. Left as a bare return it stranded the\n        // bar in GENERATING with no explanation and no event.\n        const mismatch = 'Manifest at ' + manifestPath + ' belongs to session ' + (manifest.id || 'unknown') + ', not ' + sessionId + '.';\n        reportVariantMountFailed(sessionId, visibleVariant || 1, manifestPath, mismatch);\n        showMountErrorCard(sessionId, {\n          variant: visibleVariant || 0,\n          url: manifestPath,\n          message: 'The variant manifest is for a different session. Ask the agent to republish.',\n          previewFile: manifestPath,\n        });\n        return;\n      }\n\n      const paramsByVariant = await loadSvelteComponentParams(manifest);\n      const availableVariants = Number(manifest.arrivedVariants) || Number(manifest.count) || 1;","sourceCodeStart":5757,"sourceCodeEnd":5793,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/skill/scripts/live-browser.js#L5757-L5793","documentation":"Thrown when fetching the session manifest from the local engine server (/source endpoint) returns a non-OK status. The script needs the manifest to verify that the published source at the expected path belongs to the current session; without it the mount-failure re-report check cannot proceed. The error carries only the numeric status as a string.","triggerScenarios":"fetch('http://localhost:PORT/source?token=...&path=manifestPath') resolves with res.ok === false — typically 404 when the manifest file was deleted/moved, or 401/403 when TOKEN no longer matches the running server session.","commonSituations":"Dev server restarted so the old token is invalid; manifest path changed after a rebuild; file removed by git checkout or a clean while the live session was open.","solutions":["Read the numeric status: 404 means the manifest is gone — republish the source from the agent; 401/403 means the token is stale — reload the page against the current dev server","Confirm the dev server process is alive and listening on PORT (netstat/lsof)","Reload the browser tab so the script re-handshakes and picks up a fresh TOKEN","Re-run the agent publish step so the manifest exists at the expected manifestPath"],"exampleFix":"// before\nif (!res.ok) throw new Error(String(res.status));\n// after\nif (!res.ok) throw new Error('manifest fetch failed: HTTP ' + res.status + ' for ' + manifestPath);","handlingStrategy":"retry","validationCode":"const head = await fetch(url);\nif (!head.ok) console.warn('manifest not readable:', head.status, manifestPath);","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(url);\n  if (!res.ok) throw new Error(String(res.status));\n} catch (err) {\n  showToast('Could not verify the manifest (HTTP ' + err.message + '). Republish and try again.', 3500);\n  lastReportedMountFailure = null;\n}","preventionTips":["Reload the page whenever the dev server restarts so TOKEN stays valid","Don't delete/move the manifest path mid-session; republish via the agent instead","Surface the numeric status to the user rather than silently swallowing it","Watch for repeated 404s — they indicate the publish wrote to a stale path"],"tags":["http","fetch","manifest","session"],"backgroundTag":"http-error-response","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}