AgentFixboard

WorkflowAgent fails on an image or file URL when workflow fetch is unavailable

WorkflowAgent.stream() fails before the first model call when a message contains a URL file or image part. The line is AI_DownloadError: Failed to download https://…/image.png: Error: Global "fetch" is unavailable in workflow functions.

From GitHub

vercel/ai

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
ai@7.0.143
Last checked

Verified fix: PR #22462 merged on . Fixed in ai@7.0.143 (first published release whose tag contains the merge commit). Last checked .

Symptom

WorkflowAgent.stream() fails before the first model call when a message contains a URL file or image part. The line is AI_DownloadError: Failed to download https://…/image.png: Error: Global "fetch" is unavailable in workflow functions.

Evidence what you'll see

  • The stack names downloadAssets then convertToLanguageModelPrompt then WorkflowAgent.stream.
  • A user message with an image attachment ended the agent run before the model was called, on every such turn, until a no-op experimental_download was passed.
  • Reported on @ai-sdk/workflow@2.0.68, ai@7.0.136, workflow@5.2.0.

Why it happens

Workflow-side prompt conversion declared supportedUrls: {}, so every URL was planned for download, then used the default downloader that calls globalThis.fetch. Workflow functions cannot use that fetch. Pull request 22462 keeps URLs through an unconditional no-op on the workflow side and does model-aware conversion inside the durable step.

Affected versions

@ai-sdk/workflow@2.0.68, ai@7.0.136, workflow@5.2.0. The linked issue does not name an operating system.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • WorkflowAgent.stream() with a URL-backed image part reaches the model call and does not print Global "fetch" is unavailable in workflow functions.

If it still fails

  • The linked issue does not describe AI_DownloadError on ai@7.0.143.
  • A custom experimental_download still runs in the durable step when conversion needs a download.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it