tirth8205/code-review-graph · error · ValueError

Embedding refresh refused: existing rows have no provider id

Error message

Embedding refresh refused: existing rows have no provider identity; run an explicit embed to migrate and rebuild the index.

What it means

The embeddings table exists but has no 'provider' column, meaning it predates provider-identity tracking. refresh refuses to proceed because it cannot verify the existing vectors belong to the requested provider.

Source

Thrown at code_review_graph/embeddings.py:1362

    has_table = graph_store._conn.execute(
        "SELECT 1 FROM sqlite_master "
        "WHERE type = 'table' AND name = 'embeddings'",
    ).fetchone()
    if has_table is None:
        return None
    has_rows = graph_store._conn.execute(
        "SELECT 1 FROM embeddings LIMIT 1",
    ).fetchone()
    if has_rows is None:
        return None
    try:
        rows = graph_store._conn.execute(
            "SELECT DISTINCT provider FROM embeddings ORDER BY provider",
        ).fetchall()
    except sqlite3.OperationalError as exc:
        if "no such column" in str(exc).lower() and "provider" in str(exc).lower():
            raise ValueError(
                "Embedding refresh refused: existing rows have no provider identity; "
                "run an explicit embed to migrate and rebuild the index.",
            ) from exc
        raise
    identities = {str(row["provider"]) for row in rows}

    embedding_store = EmbeddingStore(
        graph_store.db_path,
        provider=provider,
        model=model,
    )
    try:
        if not embedding_store.available or embedding_store.provider is None:
            raise RuntimeError(
                f"Embedding provider '{provider}' is unavailable in this environment.",
            )
        resolved_identity = embedding_store.provider.name
        if provider == "minimax":

View on GitHub (pinned to b58668751a)

Solutions

  1. Run a full explicit embed (re-embed the graph) to rebuild the index with the new schema
  2. Then refresh_embeddings() will work on the rebuilt table
  3. Alternatively delete the old embeddings table/db and start fresh

Example fix

# before
refresh_embeddings(gs, provider='local', model='minilm')  # old db
# after
embed_graph(gs, provider='local', model='minilm')  # migrate/rebuild
refresh_embeddings(gs, provider='local', model='minilm')
Defensive patterns

Strategy: validation

Validate before calling

try:
    cols = {r[1] for r in gs._conn.execute("PRAGMA table_info(embeddings)")}
    legacy = "provider" not in cols
except Exception:
    legacy = True
if legacy:
    raise RuntimeError("legacy embeddings table; run a full embed to migrate")

Try / catch

try:
    refresh_embeddings(gs, provider=p, model=m)
except ValueError as e:
    if "no provider identity" in str(e):
        embed_graph(gs, provider=p, model=m)  # rebuild, then refresh works
    else:
        raise

Prevention

When it happens

Trigger: Running refresh_embeddings() on a database created by an older library version whose schema lacked the provider column — sqlite3.OperationalError 'no such column: provider' is caught and converted to this ValueError.

Common situations: Upgrading the package and reusing an old .db/index file created before provider identity was introduced.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of tirth8205/code-review-graph@b58668751a (2026-08-28). Data as JSON: /api/errors/7b068fede1970560. Report an issue: GitHub.