Skip to content

File upload fails: blob URL fetch returns ERR_FAILED #1630

@lhtpluto

Description

@lhtpluto

Bug Description

File upload fails with error:

blob:http://localhost:2026/xxx:1 Failed to load resource: net::ERR_FAILED
Failed to fetch file xxx.docx: TypeError: Failed to fetch

Code Location

frontend/src/core/threads/hooks.ts:263

const response = await fetch(fileUIPart.url);  // blob URL
const blob = await response.blob();            // fails

Full Error Stack

blob:http://localhost:2026/93e20197-a4ac-4e68-a2ee-2b483873e14e:1 Failed to load resource: net::ERR_FAILED
1e7b60cd27d87c04.js:59 Failed to fetch file test.docx: TypeError: Failed to fetch
  at 1e7b60cd27d87c04.js:59:33014
  at async Promise.all (index 0)
  at async 1e7b60cd27d87c04.js:59:33160
1e7b60cd27d87c04.js:59 Failed to upload files: Error: Failed to prepare 1 attachment(s) for upload. Please retry.

Environment

  • OS: macOS (Apple Silicon)
  • Browser: Chrome 146
  • Node.js: v24.14.0
  • Docker: 29.3.1
  • DeerFlow Version: 0f1b023 (latest main)
  • Run Mode: Docker (both make docker-start and make up)

Reproduction Steps

  1. Start DeerFlow: make up or make docker-start
  2. Open http://localhost:2026 in Chrome
  3. Create a new chat
  4. Click attachment button and select any file (tried .docx, .txt, .jpg)
  5. Error: "Failed to prepare 1 attachment(s) for upload. Please retry."

Expected Behavior

File should be uploaded successfully.

Actual Behavior

Blob URL created by browser fails to fetch, upload fails.

Additional Context

  • Issue persists in both development and production modes
  • Issue persists with English file names
  • Issue persists after browser cache clear
  • Issue persists in incognito mode

Possible Cause

The fetch(fileUIPart.url) call on blob URLs is failing. This might be related to:

  • Browser security restrictions on blob URLs
  • Timing issues with blob URL lifecycle
  • React component re-rendering invalidating blob URLs

Suggested Fix

Consider storing the actual File object instead of re-fetching from blob URL, or use FileReader to read the file data directly.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions