{"record":{"id":"bd5d86a221cf5a98","repo":"NousResearch/hermes-agent","slug":"could-not-create-canvas-context","errorCode":null,"errorMessage":"could not create canvas context","messagePattern":"could not create canvas context","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/src/app/pet-generate/lib/read-reference-image.ts","lineNumber":40,"sourceCode":"    throw new Error('reference image too large')\n  }\n\n  const objectUrl = URL.createObjectURL(file)\n\n  try {\n    const img = await loadImage(objectUrl)\n    const scale = Math.min(1, max / Math.max(img.width, img.height))\n    const width = Math.max(1, Math.round(img.width * scale))\n    const height = Math.max(1, Math.round(img.height * scale))\n\n    const canvas = document.createElement('canvas')\n    canvas.width = width\n    canvas.height = height\n\n    const ctx = canvas.getContext('2d')\n\n    if (!ctx) {\n      throw new Error('could not create canvas context')\n    }\n\n    ctx.drawImage(img, 0, 0, width, height)\n\n    return canvas.toDataURL('image/png')\n  } finally {\n    URL.revokeObjectURL(objectUrl)\n  }\n}\n","sourceCodeStart":22,"sourceCodeEnd":50,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/apps/desktop/src/app/pet-generate/lib/read-reference-image.ts#L22-L50","documentation":"Error \"could not create canvas context\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at apps/desktop/src/app/pet-generate/lib/read-reference-image.ts:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry in a normal browser window; canvas 2D context can fail under GPU or privacy restrictions.","Disable extensions or flags that block canvas (anti-fingerprinting) and retry.","Update the browser/Electron runtime if canvas creation consistently fails."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}