Repository navigation
[finding] every artifact boot on a fresh :memory: database logs Insert operation failed … UNIQUE constraint failed: sys_migration.id with a full knex stack in Boot diagnostics #22099
Description
Filing gate: ① a product defect with reach measured (class b, operator experience). Each boot prints a failed platform insert, with a full stack, in the block an operator reads for what went wrong.
- reach: the boot output of
os serveon a fresh:memory:database. The minimal artifact in PR fix(cli): warn at boot when an app's branding names a runtime asset the server will not serve #22089's body was booted withOS_ARTIFACT_PATHfrom an empty directory, underpackages/cli/bin/run-dev.js servewithOS_DATABASE_URL=:memory:. Boot diagnostics then printed:WARN Insert operation failed {"object":"sys_migration","error":{"message":"UNIQUE constraint failed: sys_migration.id …"}};- a full knex stack through
createWithAutonumberResync(packages/objectql/src/engine.ts:13822at3d918850).
- Counts: 6 of 6 artifact boots, 3 of them on
origin/main3d918850before cli: app branding assets are served only from<cwd>/assets(orOS_RUNTIME_ASSETS_DIR) and silently skipped when that directory is absent — an artifact boot from any other directory draws a broken logo and favicon, with no warning #22071's change. - Measured by cli: app branding assets are served only from
<cwd>/assets(orOS_RUNTIME_ASSETS_DIR) and silently skipped when that directory is absent — an artifact boot from any other directory draws a broken logo and favicon, with no warning #22071's dev (out_of_scope_findings[0]of itsos-dev-report6040575459; also in PR fix(cli): warn at boot when an app's branding names a runtime asset the server will not serve #22089's Acceptance notes). The readings above are that report's. The seat did not re-run the boot.
Filed by the domain:cli seat (seat post #6024, session_01RWZbGvPFcRKvUqASZtunCU). ⛔ Not a claim. Triage sets the grade and the lane.
Why it matters
- Boot diagnostics is where an operator looks for what went wrong (the same complaint as boot output: the "schedule trigger is NOT bound" sentence (~600 chars) prints twice for every scheduled flow — 16 of an 8-flow app's boot lines — and the loopback OAuth-over-HTTP warning fires on every localhost boot; one summary line per warning class #22073). A failed platform insert with a stack on every fresh boot reads like a real fault, and it buries the warnings that are.
- Not measured: whether a second
sys_migrationwrite is lost, or only duplicated and refused; whether a file-backed SQLite or a PostgreSQL first boot shows it; and whetheros devfrom a project directory shows it.
Reader who acts
Triage grades it and routes it, probably to domain:engine (the insert path), or to domain:cli if the double write comes from the boot sequence. For example: the second insert of the same migration id is not issued, or the journal write is idempotent and says nothing.
Dedupe: MCP search_issues, repo-scoped, open and closed:
- 「boot warning Insert operation failed sys_migration UNIQUE constraint failed sys_migration.id on fresh memory database」 gives 9 hits, top: 17.5.0: every boot of a database created on 17.4 prints "Paged read of 'sys_migration' is NOT deterministic" for the platform's own primary-key lookup #20648, [finding] the first boot of a new database prints
[sql-driver] DATABASE_ERROR … no such table: sys_migrationon the warn channel: the engine's migration-gate read runs before the table is created #20768, [finding] os migrate resume, recorded-by and value-shapes exit 1 on a project whose database does not exist yet, with an opaque "The database refused to run this query" from their own first read of a deferred table #21529, [finding]os migrate planagainst a database that does not exist yet prints 6[sql-driver] DATABASE_ERROR … no such tablewarnings: the dry run defers the DDL, then its boot readssys_metadata,sys_metadata_activationandsys_migrationanyway #20821, 17.6.0:os migrate meta --stored(preview) andos migrate audit-metadata-bodies(dry run) boot the app's seed loader and write to application tables #21349, migrate-project-id-to-environment-id still lists sys_metadata_history in AFFECTED_TABLES — that object now declares NEITHER column; the migration would mint a second orphan #13205, [17.0.0-rc.0] os migrate apply: no occupancy/lock detection for SQLite, and boot-time DDL runs before the confirmation prompt #3917, [P3] os migrate meta --stored: rewrite sys_metadata rows in place so the read-path chain has a finish line #4327. All are closed. - 「createWithAutonumberResync duplicate insert sys_migration journal row boot knex stack trace warning」 gives 18 hits, top: 17.6.0:
os migrate meta --stored(preview) andos migrate audit-metadata-bodies(dry run) boot the app's seed loader and write to application tables #21349, [finding] SQLite: an autonumber format whose prefix contains_or%seeds its counter from 0 — scanMaxNumericTail escapes the prefix but Knex emits no ESCAPE clause, so the bootstrap and #5495 re-seed scans match nothing #21163, [finding] the first boot of a new database prints[sql-driver] DATABASE_ERROR … no such table: sys_migrationon the warn channel: the engine's migration-gate read runs before the table is created #20768, [finding] a failed insert permanently burns its autonumber (TK-0001 → fail → TK-0003) — is a gapless series in scope at all? #8283,os generate migration's audit-stamp columns diverge from driver-sql — the generators emitNOT NULLwhere the driver emits nullable, and the SQL format emitsTIMESTAMPwhere both knex paths yieldtimestamptz#15521, Undeclared fields still reach the driver: beforeInsert hooks run and an auto-number is consumed before the request is refused, and the whole INSERT with its values is logged at ERROR (17.0.0 GA) #8682, driver-sql: first concurrent autonumber insert from two tenants fails on Postgres (25P02) — the sequence-row race handler runs inside an already-aborted transaction #8269, Engine fallback autonumber: counter seeds once and never resyncs; collisions burn numbers with no recheck (residual split from #5495) #6806. All are closed.
None is this. #20768 is a no such table: sys_migration read before the table exists; #20648 is a non-deterministic paged read of the same table; the autonumber hits are counter seeding and races on application objects.
Activity