Cloudflare · tool · fg-0221

wrangler d1 execute fails with 'SQL code did not contain a statement' when a comment holds a semicolon

If you see SQL code did not contain a statement, the cause and the fix for Cloudflare are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
SQL code did not contain a statementMigration file runs fine in sqlite3 locallyRemoving the trailing commented SQL makes it pass
Cause
Older Wrangler split SQL files on every semicolon, including ones inside comments, which produced an empty statement. Wrangler 3.109.3 made the splitter skip comments.
Fix
Upgrade Wrangler to 3.109.3 or later, or remove semicolons from comments in migration files.
Apply
npm i -D wrangler@latest npx wrangler d1 migrations apply DB --remote
Affected
Wrangler before 3.109.3 (fix merged 2025-02-20)
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun