{"record":{"id":"ec4b0939bc96a617","repo":"antiwork/gumroad","slug":"the-preview-couldn-t-be-loaded","errorCode":null,"errorMessage":"The preview couldn't be loaded.","messagePattern":"The preview couldn't be loaded\\.","errorType":"exception","errorClass":"ResponseError","httpStatus":null,"severity":"error","filePath":"app/javascript/data/agent.ts","lineNumber":168,"sourceCode":"    method: \"POST\",\n    accept: \"json\",\n    url: Routes.internal_agent_custom_html_preview_path(),\n    data: {\n      endpoint: proposedActionEndpoint(action),\n      ...(typeof body === \"object\" && body !== null ? body : {}),\n    },\n  });\n  const json = typia.assert<CustomHtmlPreviewResponse>(await response.json());\n  if (!json.success) throw new ResponseError(json.error);\n  // The POST staged the document, but the iframe's own GET is a separate request that can still\n  // miss (say, the staged document expired or was evicted). Probe the URL before reporting the\n  // preview loaded — the card enables Confirm on that signal, and it must never enable it while\n  // the iframe is about to render the \"preview expired\" notice instead of the proposed page.\n  // The probe-then-load window itself is not worth guarding: the token was staged moments ago,\n  // so it sits a full TTL away from expiry and newest in the seller's eviction order — losing it\n  // mid-window would take a burst of further stagings by the same seller within milliseconds.\n  const probe = await request({ method: \"HEAD\", accept: \"html\", url: json.preview_url });\n  if (!probe.ok) throw new ResponseError(\"The preview couldn't be loaded.\");\n  return json.preview_url;\n};\n\n// One persisted message of a stored conversation, as returned by the conversations endpoint. The\n// server keeps each turn's structured extras (proposed-action card, object cards, applied status)\n// so the chat re-renders history exactly as it looked live.\nexport type ConversationMessage = {\n  role: ChatRole;\n  content: string;\n  proposed_action?: ProposedAction | null;\n  proposal_message_id?: string | null;\n  objects?: DisplayObject[] | null;\n  action_status?: \"executing\" | \"applied\" | \"unknown\" | \"dismissed\" | null;\n};\n\nexport type Conversation = {\n  id: string;\n  title: string | null;","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/antiwork/gumroad/blob/afeacbd394069a1cbf0c6c50ee8e900925050370/app/javascript/data/agent.ts#L150-L186","documentation":"Error \"The preview couldn't be loaded.\" thrown in antiwork/gumroad.","triggerScenarios":"Thrown at app/javascript/data/agent.ts:168 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afeacbd394069a1cbf0c6c50ee8e900925050370","analyzedAt":"2026-08-21T17:58:52.159Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}