{"record":{"id":"7248e0bd4c25efe5","repo":"pbakaus/impeccable","slug":"impeccable-annotation-upload-failed","errorCode":null,"errorMessage":"[impeccable] annotation upload failed:","messagePattern":"\\[impeccable\\] annotation upload failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"skill/scripts/live-browser.js","lineNumber":8532,"sourceCode":"    // never set its own bg, which is truthy and short-circuits the chain to\n    // transparent-black - modern-screenshot then renders the capture on a\n    // black canvas and the shader overlay flashes solid black during load.\n    // The browser canvas defaults to white, so we do too.\n    return '#ffffff';\n  }\n\n  function captureChromeNodes() {\n    const nodes = [];\n    const add = (node) => {\n      if (!node || node === document.body || nodes.includes(node)) return;\n      nodes.push(node);\n    };\n    add(document.getElementById(PREFIX + '-root'));\n    [\n      PREFIX + '-highlight',\n      PREFIX + '-tooltip',\n      PREFIX + '-bar',\n      PREFIX + '-picker',\n      PREFIX + '-params-panel',\n      PREFIX + '-insert-line',\n      PREFIX + '-insert-placeholder',\n      PREFIX + '-insert-create-tooltip',\n      PREFIX + '-annot',\n      PREFIX + '-design-host',\n      PREFIX + '-toast',\n      PREFIX + '-shader',\n    ].forEach((id) => add(uiGetById(id)));\n    return nodes;\n  }\n\n  async function hideCaptureChromeForShaderProxy(fn) {\n    const saved = captureChromeNodes().map((node) => ({\n      node,\n      visibility: node.style.visibility,\n      priority: node.style.getPropertyPriority('visibility'),\n    }));","sourceCodeStart":8514,"sourceCodeEnd":8550,"githubUrl":"https://github.com/pbakaus/impeccable/blob/f2c7051853848826aac2f4646581d62a732155ad/skill/scripts/live-browser.js#L8514-L8550","documentation":"When a generate/steer request carries annotations, the captured PNG is POSTed to /annotation?token=...&eventId=... on the live server, and the returned path is attached to the event as screenshotPath. A non-2xx response status or a fetch rejection is logged as 'annotation upload failed:' (with the status code or error); the event is then still sent, just without the annotated image, so the model loses the semantic input but not the request.","triggerScenarios":"Server restarted so the embedded TOKEN is stale (401); an older server build without the /annotation route (404); blob too large or server died mid-upload (network error); wrong PORT after a restart.","commonSituations":"Server restart between page load and annotation; version skew between injected client and server; uploading a very large annotated screenshot on a constrained machine.","solutions":["Check the logged status: 401 → reload the page for a fresh token; 404 → update the live server to a version with /annotation","Resend the annotated request once the server is reachable and the token fresh","Keep annotations modest in size (crop strokes, not full-page) to avoid payload limits"],"exampleFix":"// before\nif (uploadRes.ok) { /* ... */ } else { console.warn('annotation upload failed:', uploadRes.status); }\n// after: one token-refresh retry on auth failure\nif (uploadRes.status === 401) { await refreshToken(); uploadRes = await fetch(url, init); }","handlingStrategy":"retry","validationCode":"if (!blob?.size) throw new Error('nothing to upload'); // skip upload for empty captures\nconst uploadUrl = `/annotation?token=${encodeURIComponent(TOKEN)}&eventId=${encodeURIComponent(basePayload.id)}`;","typeGuard":null,"tryCatchPattern":"try {\n  let res = await fetch(uploadUrl, { method: 'POST', headers: { 'Content-Type': 'image/png' }, body: blob });\n  if (res.status === 401) { TOKEN = await refreshToken(); res = await fetch(uploadUrl, { method: 'POST', body: blob }); }\n  if (!res.ok) console.warn('annotation upload failed:', res.status);\n} catch (err) { console.warn('annotation upload failed:', err); } // always send the event afterwards","preventionTips":["Refresh the token after server restarts before uploading","Keep annotated screenshots compact (crop to the element)","Log the numeric status — 401 vs 404 vs network tells you exactly which fix applies"],"tags":["upload","annotation","dev-server","http-status","screenshot"],"backgroundTag":"upload-request-failed","analyzedSha":"f2c7051853848826aac2f4646581d62a732155ad","analyzedAt":"2026-08-18T04:58:36.608Z","contentChangedAt":"2026-08-18T04:58:36.608Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}