{"record":{"id":"44489a4d65b0cecb","repo":"Significant-Gravitas/AutoGPT","slug":"copy-failed-res-status","errorCode":null,"errorMessage":"Copy failed: ${res.status}","messagePattern":"Copy failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/useArtifactPanel.ts","lineNumber":56,"sourceCode":"  // onOpenChange already routes to clearArtifactPreview. A manual document\n  // listener here would self-block on the drawer's own [role=\"dialog\"].\n\n  const canCopy =\n    classification != null &&\n    classification.type !== \"image\" &&\n    classification.type !== \"video\" &&\n    classification.type !== \"download-only\" &&\n    classification.type !== \"pdf\";\n\n  function handleCopy() {\n    if (!activeArtifact || !canCopy) return;\n    // Reuse content already fetched by the preview pane when available —\n    // Copy should feel instant, not trigger a second network round-trip.\n    const cached = getCachedArtifactContent(activeArtifact.id);\n    const textPromise = cached\n      ? Promise.resolve(cached)\n      : fetch(activeArtifact.sourceUrl).then((res) => {\n          if (!res.ok) throw new Error(`Copy failed: ${res.status}`);\n          return res.text();\n        });\n    textPromise\n      .then((text) => navigator.clipboard.writeText(text))\n      .then(() => {\n        toast({ title: \"Copied to clipboard\" });\n      })\n      .catch(() => {\n        toast({\n          title: \"Copy failed\",\n          description: \"Couldn't read the file or access the clipboard.\",\n          variant: \"destructive\",\n        });\n      });\n  }\n\n  function handleDownload() {\n    if (!activeArtifact) return;","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/useArtifactPanel.ts#L38-L74","documentation":"HTTP 404 from POST /blocks/{block_id}/execute when get_block(block_id) returns nothing — the block identifier is not registered in the running backend's block registry. The block may exist in the codebase but be unregistered (import failure, disabled provider) or the id may simply be wrong.","triggerScenarios":"Calling direct block execution with a block id that isn't registered: typo, a block removed/renamed between versions, or a block whose provider module failed to import so it never registered.","commonSituations":"Frontend built against a newer backend that has a block this backend lacks (version skew); block renamed with the old id persisted in saved state; conditional blocks that only register when their optional deps are installed.","solutions":["List available blocks (GET /blocks) and use the exact id from the registry.","If the block should exist, check backend startup logs for import/registration errors and missing optional dependencies.","Regenerate frontend API types after backend upgrades so block ids stay in sync."],"exampleFix":"// before\nawait api.post(`/blocks/${blockId}/execute`, data);\n\n// after\nconst blocks = await api.get('/blocks');\nconst block = blocks.find(b => b.id === blockId);\nif (!block) throw new Error(`Block ${blockId} not registered`);\nawait api.post(`/blocks/${block.id}/execute`, data);","handlingStrategy":"validation","validationCode":"const blocks = await api.get('/blocks');\nif (!blocks.some(b => b.id === blockId)) throw new Error('Unknown block');\nawait api.post(`/blocks/${blockId}/execute`, data);","typeGuard":"const isRegisteredBlock = (blocks: Block[], id: string): boolean =>\n  blocks.some(b => b.id === id);","tryCatchPattern":"const resp = await api.post(`/blocks/${blockId}/execute`, data);\nif (resp.status === 404) { refreshBlockRegistry(); }","preventionTips":["Validate block ids against the live /blocks registry","Check backend startup logs for block import failures","Regenerate API types after upgrades to catch renamed blocks"],"tags":["blocks","not-found","registry"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}