{"record":{"id":"7b068fede1970560","repo":"tirth8205/code-review-graph","slug":"embedding-refresh-refused-existing-rows-have-no-p","errorCode":null,"errorMessage":"Embedding refresh refused: existing rows have no provider identity; run an explicit embed to migrate and rebuild the index.","messagePattern":"Embedding refresh refused: existing rows have no provider identity; run an explicit embed to migrate and rebuild the index\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"code_review_graph/embeddings.py","lineNumber":1362,"sourceCode":"\n    has_table = graph_store._conn.execute(\n        \"SELECT 1 FROM sqlite_master \"\n        \"WHERE type = 'table' AND name = 'embeddings'\",\n    ).fetchone()\n    if has_table is None:\n        return None\n    has_rows = graph_store._conn.execute(\n        \"SELECT 1 FROM embeddings LIMIT 1\",\n    ).fetchone()\n    if has_rows is None:\n        return None\n    try:\n        rows = graph_store._conn.execute(\n            \"SELECT DISTINCT provider FROM embeddings ORDER BY provider\",\n        ).fetchall()\n    except sqlite3.OperationalError as exc:\n        if \"no such column\" in str(exc).lower() and \"provider\" in str(exc).lower():\n            raise ValueError(\n                \"Embedding refresh refused: existing rows have no provider identity; \"\n                \"run an explicit embed to migrate and rebuild the index.\",\n            ) from exc\n        raise\n    identities = {str(row[\"provider\"]) for row in rows}\n\n    embedding_store = EmbeddingStore(\n        graph_store.db_path,\n        provider=provider,\n        model=model,\n    )\n    try:\n        if not embedding_store.available or embedding_store.provider is None:\n            raise RuntimeError(\n                f\"Embedding provider '{provider}' is unavailable in this environment.\",\n            )\n        resolved_identity = embedding_store.provider.name\n        if provider == \"minimax\":","sourceCodeStart":1344,"sourceCodeEnd":1380,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/embeddings.py#L1344-L1380","documentation":"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.","triggerScenarios":"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.","commonSituations":"Upgrading the package and reusing an old .db/index file created before provider identity was introduced.","solutions":["Run a full explicit embed (re-embed the graph) to rebuild the index with the new schema","Then refresh_embeddings() will work on the rebuilt table","Alternatively delete the old embeddings table/db and start fresh"],"exampleFix":"# before\nrefresh_embeddings(gs, provider='local', model='minilm')  # old db\n# after\nembed_graph(gs, provider='local', model='minilm')  # migrate/rebuild\nrefresh_embeddings(gs, provider='local', model='minilm')","handlingStrategy":"validation","validationCode":"try:\n    cols = {r[1] for r in gs._conn.execute(\"PRAGMA table_info(embeddings)\")}\n    legacy = \"provider\" not in cols\nexcept Exception:\n    legacy = True\nif legacy:\n    raise RuntimeError(\"legacy embeddings table; run a full embed to migrate\")","typeGuard":null,"tryCatchPattern":"try:\n    refresh_embeddings(gs, provider=p, model=m)\nexcept ValueError as e:\n    if \"no provider identity\" in str(e):\n        embed_graph(gs, provider=p, model=m)  # rebuild, then refresh works\n    else:\n        raise","preventionTips":["After upgrading the library, run one full embed before refresh","Detect legacy schemas with PRAGMA table_info before refreshing","Version your index files alongside the library version"],"tags":["embeddings","schema-migration","legacy-data","sqlite"],"backgroundTag":"schema-validation-failed","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}