Summary
Fresh gbrain init --pglite on v0.36.3.0 lands in a state where embedding_model config says openai:text-embedding-3-large but the embed pipeline tries ZeroEntropy (zembed-1 1280d), causing every page to fail with expected 1536 dimensions, not 1280.
The state is sticky — wiping ~/.gbrain/brain.pglite and re-running init does NOT reset it. Same error persists even after unset ZEROENTROPY_API_KEY.
Environment
- gbrain version: 0.36.3.0
- Repo commit: 1d5f69f
- bun: 1.x (installed via Homebrew)
- macOS: 26.3.1 (M-series Mac)
Steps to reproduce
git clone https://github.com/garrytan/gbrain.git ~/sandbox/gbrain
cd ~/sandbox/gbrain
bun install && bun link
export OPENAI_API_KEY=sk-proj-...
export ZEROENTROPY_API_KEY=ze_...
gbrain init --pglite
gbrain import /some/markdown/dir/ --no-embed # 31 files, 234 chunks ok
gbrain embed --stale
Result:
Error embedding entities/nvda: expected 1536 dimensions, not 1280
Error embedding concepts/ai-model-release-cycle: expected 1536 dimensions, not 1280
...
[embed.pages] 31/31 (100%)
Embedded 0 chunks across 31 pages
Investigation
gbrain config get embedding_model returns text-embedding-3-large (no provider prefix)
gbrain config get embedding_dimensions returns 1536
gbrain config set embedding_model openai:text-embedding-3-large succeeds, but embed pipeline still tries ZE
gbrain providers list shows openai + zeroentropyai both ready
gbrain doctor warns embedding_provider: zeroentropyai:zembed-1 responds (925ms, 1280 dims) but: DB dimension mismatch: column is vector(1536) but provider returns 1280-dim
Workarounds tried (none worked)
| Attempt |
Result |
gbrain config set embedding_model openai:text-embedding-3-large |
embed still routes to ZE |
unset ZEROENTROPY_API_KEY before embed |
error switches to ZeroEntropy embedding requires ZEROENTROPY_API_KEY (still ZE-routed) |
rm -rf ~/.gbrain/brain.pglite && gbrain init --pglite |
same state persists across reinits |
gbrain init --pglite --embedding-dimensions 1280 |
flag silently ignored, dimensions still 1536 |
gbrain ze-switch |
command exists but produces no output, no state change |
gbrain config set ze_switch_declined_at "<iso>" |
doesn't unstick the embed path |
Suspected root cause (from reading source)
src/core/retrieval-upgrade-planner.ts defines a ZE-as-default switch flow (v0.36.0.0). On fresh init when OPENAI_API_KEY is set, isLegacyDefault=true triggers zeSwitchOffered=true, but ze_switch_applied is never written, leaving the embed pipeline in a half-migrated state where it routes to ZE_TARGET_EMBEDDING_MODEL even though gbrain config get embedding_model returns the OpenAI default.
loadConfigWithEngine in src/core/config.ts doesn't merge embedding_model from the DB plane (only embedding_multimodal, embedding_columns, search_embedding_column, etc.), so user config set embedding_model writes to the DB but the embed code reads the gateway default.
Impact
Cannot complete fresh PGLite install following INSTALL_FOR_AGENTS.md.
Suggested fix directions (no PR yet)
loadConfigWithEngine should merge embedding_model from DB plane the same way other embedding_* keys are merged.
gbrain init --pglite should either complete the ZE switch (if ZE key set) or hard-refuse it (if dim mismatch), not leave half-state.
gbrain ze-switch should print what it's doing (currently silent, no diagnostic output).
gbrain init --embedding-dimensions N flag should be honored or removed from CLI help.
Summary
Fresh
gbrain init --pgliteon v0.36.3.0 lands in a state whereembedding_modelconfig saysopenai:text-embedding-3-largebut the embed pipeline tries ZeroEntropy (zembed-11280d), causing every page to fail withexpected 1536 dimensions, not 1280.The state is sticky — wiping
~/.gbrain/brain.pgliteand re-runninginitdoes NOT reset it. Same error persists even afterunset ZEROENTROPY_API_KEY.Environment
Steps to reproduce
Result:
Investigation
gbrain config get embedding_modelreturnstext-embedding-3-large(no provider prefix)gbrain config get embedding_dimensionsreturns1536gbrain config set embedding_model openai:text-embedding-3-largesucceeds, but embed pipeline still tries ZEgbrain providers listshows openai + zeroentropyai both readygbrain doctorwarnsembedding_provider: zeroentropyai:zembed-1 responds (925ms, 1280 dims) but: DB dimension mismatch: column is vector(1536) but provider returns 1280-dimWorkarounds tried (none worked)
gbrain config set embedding_model openai:text-embedding-3-largeunset ZEROENTROPY_API_KEYbefore embedZeroEntropy embedding requires ZEROENTROPY_API_KEY(still ZE-routed)rm -rf ~/.gbrain/brain.pglite && gbrain init --pglitegbrain init --pglite --embedding-dimensions 1280gbrain ze-switchgbrain config set ze_switch_declined_at "<iso>"Suspected root cause (from reading source)
src/core/retrieval-upgrade-planner.tsdefines a ZE-as-default switch flow (v0.36.0.0). On fresh init whenOPENAI_API_KEYis set,isLegacyDefault=truetriggerszeSwitchOffered=true, butze_switch_appliedis never written, leaving the embed pipeline in a half-migrated state where it routes toZE_TARGET_EMBEDDING_MODELeven thoughgbrain config get embedding_modelreturns the OpenAI default.loadConfigWithEngineinsrc/core/config.tsdoesn't mergeembedding_modelfrom the DB plane (onlyembedding_multimodal,embedding_columns,search_embedding_column, etc.), so userconfig set embedding_modelwrites to the DB but the embed code reads the gateway default.Impact
Cannot complete fresh PGLite install following INSTALL_FOR_AGENTS.md.
Suggested fix directions (no PR yet)
loadConfigWithEngineshould mergeembedding_modelfrom DB plane the same way otherembedding_*keys are merged.gbrain init --pgliteshould either complete the ZE switch (if ZE key set) or hard-refuse it (if dim mismatch), not leave half-state.gbrain ze-switchshould print what it's doing (currently silent, no diagnostic output).gbrain init --embedding-dimensions Nflag should be honored or removed from CLI help.