#5564 Unable to apply D1 migration: syntax error
Inconsistent reports on fix status; trivial workaround exists
Verify if still an issue in 4.x
Analysis Report
Issue Review: cloudflare/workers-sdk#5564
Summary
D1 migration fails with syntax error when SQL statement doesn't end with semicolon.
Findings
- Created: 2024-04-09
- Updated: 2025-10-30
- Version: wrangler 3.48.0 → wrangler 4.61.0
- Component: wrangler (D1)
- Labels: bug, d1
- Comments: 5
Key Evidence
- Error:
near "INSERT": syntax error at offset 370 - Workaround: Add semicolon at end of SQL file
- Maintainer @rozenmd mentioned a fix was merged and unmerged
- User @gentamura reported wrangler 3.80.5 fixed it (but 3.57.1 had issue)
- User @Svenlaa reported issue still exists in wrangler 3.99.0 (Dec 2024)
- Inconsistent reports suggest the fix may be partial or regressed
Recommendation
Status: NEEDS VERIFICATION
Reasoning: Reports are inconsistent - some users say it's fixed in certain versions, others say it persists. A fix was supposedly merged but may have been reverted. The workaround (adding semicolon) is trivial.
Action: Verify if this is still an issue in wrangler 4.61.0. If the semicolon requirement is intentional, update documentation. If it's a bug, implement proper fix.
Suggested Comment
Hi, this issue has mixed reports about whether it's fixed. Could someone confirm if this is still an issue with wrangler 4.x?
In the meantime, adding a semicolon at the end of your SQL statements should work as a workaround. While SQLite doesn't strictly require trailing semicolons for single statements, it's generally good practice to include them.
Notes & Feedback (0)
No notes yet.