Workers SDK Issue Reports

← Back to Dashboard

#11087 d1 execute remote with sql file, failed with TypeError: fetch failed

Recommendation:KEEP OPEN
Difficulty:n/a
Reasoning:

Confirmed bug affecting large SQL file imports to D1 --remote. Multiple users report "fetch failed" timeout after upload. Related to #11958. Maintainer reproduced the issue.

Suggested Action:

Link to #11958; keep open as legitimate bug in D1 import handling.

Analysis Report

Issue Review: cloudflare/workers-sdk#11087

Summary

wrangler d1 execute --remote --file fails with "TypeError: fetch failed" when importing large SQL files.

Findings

  • Created: 2025-10-24
  • Updated: 2026-01-15
  • Version: wrangler 4.45.0 → 4.60.0 (current)
  • Component: D1 (wrangler)
  • Labels: bug, d1
  • Comments: 3

Key Evidence

  • Reporter provided debug logs showing upload completes but then fails with "fetch failed"
  • Another user (jgennari) confirmed the issue on 2026-01-15 with an 800MB backup file, noting smaller files (50 lines) work fine
  • Related issue #11958 "Network connection lost with large D1 Import" describes the same problem pattern
  • A maintainer (edmundhung) commented on #11958, confirming they reproduced a "fetch failed" timeout during testing
  • Issue #9503 describes similar remote execution failures, though that was related to PRAGMA foreign_keys (different root cause)
  • No merged PRs reference fixing this issue
  • Issue not mentioned in CHANGELOG
  • The problem appears to be a timeout during the import processing phase for large files

Related Issues

  • #11958: "Network connection lost with large D1 Import" - same underlying issue
  • #9503: "Wrangler D1 import — succeeds locally but fails on remote" - related but different cause (PRAGMA foreign_keys)

Recommendation

Status: KEEP OPEN

Reasoning: This is a confirmed, reproducible bug affecting multiple users attempting to import large SQL files to D1 remotely. The error occurs after file upload completes, during the processing phase, suggesting a timeout issue in the import API or polling mechanism. A maintainer has acknowledged the problem in the related issue #11958.

Action: Keep open. This is a legitimate bug that needs investigation. Consider linking to #11958 as they appear to be duplicates or closely related issues. The workaround suggested by the maintainer is to split SQL files into smaller chunks (~50k lines).

Suggested Comment

This issue appears to be related to #11958 which describes similar behavior with large D1 imports. A maintainer has confirmed reproducing the "fetch failed" timeout issue.

Workaround: Split your SQL file into smaller chunks (~50k lines or less) and import them sequentially.

Are you able to try with the latest wrangler version (4.60.0) and confirm if the issue persists?

Notes & Feedback (0)

No notes yet.

Add Note