Skip to content

[config] ENGRAM_EMBEDDING_DIMS is parseInt'ed without a finite check — a non-numeric value yields float[NaN] in the vec0 DDL and initDatabase throws on every command #102

Description

@devinmlowe

Evidence

src/_core/config/index.ts:183-185:

dimensions: env.ENGRAM_EMBEDDING_DIMS
  ? parseInt(env.ENGRAM_EMBEDDING_DIMS, 10)
  : (overrides?.embedding?.dimensions ?? defaults.embedding.dimensions),

parseRetentionDays in the same file guards with Number.isFinite; this one does not. The value reaches createVecIfNeeded(db, table, dims) (src/_core/db/schema.ts:894-897) as CREATE VIRTUAL TABLE … USING vec0(id TEXT PRIMARY KEY, embedding float[NaN]).

Why it's a bug

ENGRAM_EMBEDDING_DIMS=256px (or any value parseInt cannot parse) makes every engram command and the daemon fail at initDatabase with sqlite-vec's could not parse vector column 'embedding float[NaN]' — an error that names neither the variable nor the value. Documented variable (README: "must match the existing DB"), misconfiguration trigger, loud failure → P3.

Suggested direction

Validate in loadConfig (positive integer, else throw naming the variable) — engram doctor's env-file check could flag it too.

Related: #61.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: P3Later: consistency, hardening, design work with no observed failures

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions