Workers SDK Issue Reports

← Back to Dashboard

#9133 D1Database.exec incomplete input error caused by multi-line SQL

Recommendation:KEEP OPEN
Difficulty:n/a
Reasoning:

Maintainer-confirmed bug (Aug 2025). D1 exec() fails with newlines in local dev. Has "internal" label - requires D1 platform fix. No merged PRs or changelog entries.

Suggested Action:

Leave open - confirmed bug awaiting D1 platform team fix

Analysis Report

Issue Review: cloudflare/workers-sdk#9133

Summary

D1Database.exec() fails with "incomplete input" error when SQL contains newlines in local dev.

Findings

  • Created: 2025-05-03
  • Updated: 2025-08-11
  • Version: Wrangler 4.14.1 → 4.60.0 (current)
  • Component: D1 (local development)
  • Labels: bug, internal, d1, awaiting Cloudflare response
  • Comments: 4

Key Evidence

  • Maintainer (petebacondarwin) confirmed reproduction locally on 2025-08-11 and reopened the issue
  • Simple reproduction provided: multi-line SQL in env.DB.exec() fails with SQLITE_ERROR
  • Reporter found workaround: .replaceAll(/\n/gm, " ") to strip newlines
  • Bug only affects local development - reporter noted "same migration script works in SQLite and when sending to D1 API via fetch"
  • Has "internal" label indicating it requires Cloudflare Platform support
  • Has "awaiting Cloudflare response" label - team needs to address
  • No merged PRs reference fixing this issue
  • No changelog entries for this issue
  • Significant version gap since report (4.14.1 → 4.60.0) but no evidence of fix

Reproduction Code (from maintainer comment)

export default {
  async fetch(request, env, ctx) {
    const result = await env.DB.exec(`CREATE TABLE my_cool_table (
id TEXT
);`);
    return new Response('Hello World!' + result.count);
  },
};

Recommendation

Status: KEEP OPEN

Reasoning: This is a confirmed, reproducible bug that has been validated by a maintainer. The issue has the "internal" and "awaiting Cloudflare response" labels, indicating it requires platform-level work from the Cloudflare team. No evidence of any fix has been found in PRs or changelogs.

Action: Leave open - this is a valid bug awaiting resolution by the Cloudflare team. The labels accurately reflect its status.

Notes & Feedback (0)

No notes yet.

Add Note