Summary
Upgrading from gbrain 0.22.0 (commit 172b55b, source-linked install via bun link) to 0.27.0 (commit ee9ceb3, master HEAD as of 2026-05-06): gbrain init --migrate-only crashes with column "provider_id" does not exist after the bootstrap probe announces "Pre-v0.21 brain detected" — even though gbrain doctor confirmed schema_version 29 (latest 29) before the upgrade.
This looks like the same wedge-cycle class addressed by v0.22.6.1, but the bootstrap probe is mis-classifying a modern brain (schema v29) and applying pre-v0.21 forward-references that crash on the new v0.27 provider_id column.
Likely related: #615 (agent_name on schema v24 → v34), #609 (mcp_request_log columns on PGLite v0.26.6).
Environment
- gbrain (pre-upgrade): 0.22.0 source @ commit
172b55b — binary self-reported 0.21.0 due to the package.json version-bump bug fixed in 0.27.0
- gbrain (target): 0.27.0 (commit
ee9ceb3)
- Install method: local clone at
~/gbrain/ linked via bun link (~/.bun/install/global/node_modules/gbrain → ~/gbrain, bin → src/cli.ts)
- Engine: PGLite
- Pre-upgrade: 1788 pages, schema_version 29 (latest 29 at v0.22.0)
- Target schema_version per
apply-migrations output: 36
- Bun: 1.3.13
- OS: macOS Darwin 25.1.0
Pre-upgrade state (doctor --json, key fields only)
{
"schema_version": 2,
"status": "warnings",
"health_score": 70,
"checks": [
{"name": "connection", "status": "ok", "message": "Connected, 1788 pages"},
{"name": "schema_version", "status": "ok", "message": "Version 29 (latest: 29)"},
{"name": "embeddings", "status": "ok", "message": "100% coverage, 1 missing"},
{"name": "rls", "status": "ok", "message": "Skipped (PGLite — no PostgREST exposure, RLS not applicable)"}
]
}
The schema_version check explicitly reports "Version 29 (latest: 29)" — not pre-v0.21.
Repro
# Starting state: gbrain at SHA 172b55b (v0.22.0), brain at schema v29
gbrain doctor --json | jq '.checks[] | select(.name=="schema_version")'
# => {"name":"schema_version","status":"ok","message":"Version 29 (latest: 29)"}
cd ~/gbrain
git pull origin master # → ee9ceb3 (v0.27.0)
bun install # (postinstall hits chmod issue, see Note)
chmod +x src/cli.ts # restore exec bit on bin symlink target
gbrain --version # gbrain 0.27.0
gbrain apply-migrations --yes
# Applies "v0.22.4 frontmatter-guard adoption", then prints:
# ⚠️ Schema version 29 is behind latest 36.
# To run them now: gbrain init --migrate-only
gbrain init --migrate-only
Output
Pre-v0.21 brain detected, applying forward-reference bootstrap
column "provider_id" does not exist
(exit code 1)
Expected
Per the v0.22.6.1 release notes ("No-op on fresh installs and modern brains"), the bootstrap probe should detect schema v29 and skip the pre-v0.21 forward-references, then run the v29 → v36 migration chain.
Actual
Bootstrap mis-classifies a confirmed schema-v29 brain as pre-v0.21 and crashes on what appears to be a v0.27-introduced column (provider_id, presumably from the new AI gateway architecture).
Resolution on our end
Rolled back successfully:
mv ~/.gbrain ~/.gbrain.failed-migration-<date> && mv ~/.gbrain.bak.<date> ~/.gbrain
cd ~/gbrain && git reset --hard 172b55b && chmod +x src/cli.ts && bun install
- Brain back at 1788 pages / schema v29 / v0.22.0 binary, fully operational.
The half-migrated brain is preserved locally for diagnostics. It contains personal content so I can't attach it directly, but happy to provide a scrubbed PGLite dump or specific table snapshots (pages, links, migrations ledger, etc.) if that would help narrow this down.
Note: postinstall hook permission failure (probably orthogonal)
After bun install, the postinstall hook (gbrain apply-migrations --yes --non-interactive) hit Permission denied on ~/.bun/bin/gbrain. Root cause: src/cli.ts is committed at mode 100644 upstream but needs 100755 for the bin symlink to execute. A previous postinstall had chmod +x'd it locally; resetting the working tree reverted that. Manual chmod +x src/cli.ts is a workaround. May be worth committing the file at 100755 upstream so the symlink is executable on first install.
Summary
Upgrading from
gbrain 0.22.0(commit172b55b, source-linked install viabun link) to0.27.0(commitee9ceb3, master HEAD as of 2026-05-06):gbrain init --migrate-onlycrashes withcolumn "provider_id" does not existafter the bootstrap probe announces "Pre-v0.21 brain detected" — even thoughgbrain doctorconfirmed schema_version 29 (latest 29) before the upgrade.This looks like the same wedge-cycle class addressed by v0.22.6.1, but the bootstrap probe is mis-classifying a modern brain (schema v29) and applying pre-v0.21 forward-references that crash on the new v0.27
provider_idcolumn.Likely related: #615 (
agent_nameon schema v24 → v34), #609 (mcp_request_logcolumns on PGLite v0.26.6).Environment
172b55b— binary self-reported0.21.0due to the package.json version-bump bug fixed in 0.27.0ee9ceb3)~/gbrain/linked viabun link(~/.bun/install/global/node_modules/gbrain→~/gbrain, bin →src/cli.ts)apply-migrationsoutput: 36Pre-upgrade state (doctor --json, key fields only)
{ "schema_version": 2, "status": "warnings", "health_score": 70, "checks": [ {"name": "connection", "status": "ok", "message": "Connected, 1788 pages"}, {"name": "schema_version", "status": "ok", "message": "Version 29 (latest: 29)"}, {"name": "embeddings", "status": "ok", "message": "100% coverage, 1 missing"}, {"name": "rls", "status": "ok", "message": "Skipped (PGLite — no PostgREST exposure, RLS not applicable)"} ] }The
schema_versioncheck explicitly reports "Version 29 (latest: 29)" — not pre-v0.21.Repro
Output
(exit code 1)
Expected
Per the v0.22.6.1 release notes ("No-op on fresh installs and modern brains"), the bootstrap probe should detect schema v29 and skip the pre-v0.21 forward-references, then run the v29 → v36 migration chain.
Actual
Bootstrap mis-classifies a confirmed schema-v29 brain as pre-v0.21 and crashes on what appears to be a v0.27-introduced column (
provider_id, presumably from the new AI gateway architecture).Resolution on our end
Rolled back successfully:
mv ~/.gbrain ~/.gbrain.failed-migration-<date> && mv ~/.gbrain.bak.<date> ~/.gbraincd ~/gbrain && git reset --hard 172b55b && chmod +x src/cli.ts && bun installThe half-migrated brain is preserved locally for diagnostics. It contains personal content so I can't attach it directly, but happy to provide a scrubbed PGLite dump or specific table snapshots (
pages,links,migrationsledger, etc.) if that would help narrow this down.Note: postinstall hook permission failure (probably orthogonal)
After
bun install, the postinstall hook (gbrain apply-migrations --yes --non-interactive) hitPermission deniedon~/.bun/bin/gbrain. Root cause:src/cli.tsis committed at mode100644upstream but needs100755for the bin symlink to execute. A previous postinstall hadchmod +x'd it locally; resetting the working tree reverted that. Manualchmod +x src/cli.tsis a workaround. May be worth committing the file at100755upstream so the symlink is executable on first install.