#9479 SQL[lite] files fail for `.exec(...)` that succeed with CLI invokation
Duplicate of #9133 - D1Database.exec() fails with newlines. Bug confirmed and reproduced by maintainer on #9133; tracked as D1 platform issue with `internal` label.
Close as duplicate of #9133
Analysis Report
Issue Review: cloudflare/workers-sdk#9479
Summary
D1Database.exec() fails with "incomplete input" error when SQL contains newlines (\n or \r\n), while the same SQL works via CLI.
Findings
- Created: 2025-06-04
- Updated: 2025-07-01
- Version: wrangler 4.14.4 → 4.60.0
- Component: D1
- Labels:
bug,d1 - Comments: 1 (maintainer asking for clarification)
Key Evidence
Duplicate of #9133: Issue #9133 "D1Database.exec incomplete input error caused by multi-line SQL" describes the exact same bug:
- Same error:
incomplete input: SQLITE_ERROR - Same cause: multi-line SQL passed to
D1Database.exec() - Same workaround: replace newlines with spaces
- Same error:
Confirmed and reproduced: Maintainer @petebacondarwin confirmed and reproduced the bug in #9133 on 2025-08-11
Root cause identified: Issue #9133 has
internalandawaiting Cloudflare responselabels, indicating this is a platform-level D1 API bug, not a wrangler issueNo fix merged: No PRs reference either issue, no changelog entries found
Recommendation
Status: CLOSE
Reasoning: This issue is a duplicate of #9133, which is already tracked, confirmed, and awaiting a fix from the Cloudflare D1 platform team. Having two open issues for the same bug fragments discussion and makes tracking harder.
Action: Close as duplicate of #9133
Suggested Comment
Closing this as a duplicate of #9133, which tracks the same issue:
D1Database.exec()fails with "incomplete input" errors when the SQL contains newlines.The bug has been confirmed and reproduced - it's a D1 platform issue that's being tracked internally. Please subscribe to #9133 for updates.
Workaround: Strip newlines from SQL before passing to
.exec():await env.DB.exec(sql.replace(/[\r\n]+/g, ' '));
Notes & Feedback (0)
No notes yet.