Significant-Gravitas/AutoGPT · error · Error

Copy failed: ${res.status}

Error message

Copy failed: ${res.status}

What it means

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.

Source

Thrown at autogpt_platform/frontend/src/app/(platform)/copilot/components/ArtifactPanel/useArtifactPanel.ts:56

  // onOpenChange already routes to clearArtifactPreview. A manual document
  // listener here would self-block on the drawer's own [role="dialog"].

  const canCopy =
    classification != null &&
    classification.type !== "image" &&
    classification.type !== "video" &&
    classification.type !== "download-only" &&
    classification.type !== "pdf";

  function handleCopy() {
    if (!activeArtifact || !canCopy) return;
    // Reuse content already fetched by the preview pane when available —
    // Copy should feel instant, not trigger a second network round-trip.
    const cached = getCachedArtifactContent(activeArtifact.id);
    const textPromise = cached
      ? Promise.resolve(cached)
      : fetch(activeArtifact.sourceUrl).then((res) => {
          if (!res.ok) throw new Error(`Copy failed: ${res.status}`);
          return res.text();
        });
    textPromise
      .then((text) => navigator.clipboard.writeText(text))
      .then(() => {
        toast({ title: "Copied to clipboard" });
      })
      .catch(() => {
        toast({
          title: "Copy failed",
          description: "Couldn't read the file or access the clipboard.",
          variant: "destructive",
        });
      });
  }

  function handleDownload() {
    if (!activeArtifact) return;

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. List available blocks (GET /blocks) and use the exact id from the registry.
  2. If the block should exist, check backend startup logs for import/registration errors and missing optional dependencies.
  3. Regenerate frontend API types after backend upgrades so block ids stay in sync.

Example fix

// before
await api.post(`/blocks/${blockId}/execute`, data);

// after
const blocks = await api.get('/blocks');
const block = blocks.find(b => b.id === blockId);
if (!block) throw new Error(`Block ${blockId} not registered`);
await api.post(`/blocks/${block.id}/execute`, data);
Defensive patterns

Strategy: validation

Validate before calling

const blocks = await api.get('/blocks');
if (!blocks.some(b => b.id === blockId)) throw new Error('Unknown block');
await api.post(`/blocks/${blockId}/execute`, data);

Type guard

const isRegisteredBlock = (blocks: Block[], id: string): boolean =>
  blocks.some(b => b.id === id);

Try / catch

const resp = await api.post(`/blocks/${blockId}/execute`, data);
if (resp.status === 404) { refreshBlockRegistry(); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/44489a4d65b0cecb. Report an issue: GitHub.