Windows CRLF breaks SQLite trigger migrations: a ChatGPT Sites + Cloudflare D1 debugging story

CryptoDir · reddit · 2026-10-05

A detailed debugging writeup of a ChatGPT Sites managed deployment failing with incomplete input: SQLITEERROR during a Cloudflare D1 migration that creates two SQLite triggers.

Findings: local Wrangler/workerd tests passed; the Git file is LF (1,781 bytes), but Windows core.autocrlf=true converted the checkout to CRLF, and the packager preserved checkout bytes — the deployed archive was CRLF (1,816 bytes, 35 extra carriage returns). The triggers use uppercase BEGIN and SELECT RAISE(…) bodies, matching Cloudflare workers-sdk issues #14991 and #15314 on trigger parsing, keyword casing and line endings.

Fix: a narrowly scoped .gitattributes rule restoring LF for that migration, whose resulting bytes match the original Git blob exactly.

Open problem: Sites tools don't expose the migration ledger or trigger definitions, so it's unclear whether the failed migration was wholly rolled back, partially applied, or recorded. The author awaits read-only state confirmation from support and wants a minimal, data-preserving recovery — not a database reset.

Original post →

More from coding & agent

coding & agent channel →