{"record":{"id":"6fd68456709ca2ac","repo":"tirth8205/code-review-graph","slug":"embedding-provider-provider-is-unavailable-in","errorCode":null,"errorMessage":"Embedding provider '{provider}' is unavailable in this environment.","messagePattern":"Embedding provider '(.+?)' is unavailable in this environment\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"code_review_graph/embeddings.py","lineNumber":1376,"sourceCode":"            \"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\":\n            resolved_model = resolved_identity.partition(\":\")[2]\n            if model != resolved_model:\n                raise ValueError(\n                    f\"MiniMax refresh model must be '{resolved_model}', got '{model}'.\",\n                )\n        if identities != {resolved_identity}:\n            existing = \", \".join(sorted(identities))\n            raise ValueError(\n                \"Embedding refresh refused: existing embeddings use \"\n                f\"{existing}; requested provider resolves to {resolved_identity}.\",\n            )\n\n        purged = embedding_store.purge_orphans()\n        all_nodes: list[GraphNode] = []","sourceCodeStart":1358,"sourceCodeEnd":1394,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/embeddings.py#L1358-L1394","documentation":"refresh_embeddings() constructed the embedding store but found it unavailable (no resolvable provider) in the current environment — e.g. the required API key env var is missing — so it raises RuntimeError rather than partially refreshing.","triggerScenarios":"Calling refresh_embeddings(provider='voyage') without VOYAGE_API_KEY set (analogously for openai/google/minimax keys), so embedding_store.available is False or provider is None.","commonSituations":"Running refresh on a machine/CI job that lacks the secrets used when the index was originally embedded, or rotating to a new environment without re-exporting env vars.","solutions":["Export the key the provider needs (VOYAGE_API_KEY, MINIMAX_API_KEY, GOOGLE_API_KEY, or the CRG_OPENAI_* trio)","Confirm with the provider's env check (printenv) before re-running refresh","If the environment truly can't reach the provider, run refresh from a machine that can"],"exampleFix":"# before\nrefresh_embeddings(gs, provider='voyage', model='voyage-3-lite')  # no key\n# after\nexport VOYAGE_API_KEY=pa-...\nrefresh_embeddings(gs, provider='voyage', model='voyage-3-lite')","handlingStrategy":"validation","validationCode":"REQUIRED = {\"voyage\": [\"VOYAGE_API_KEY\"], \"minimax\": [\"MINIMAX_API_KEY\"], \"google\": [\"GOOGLE_API_KEY\"], \"openai\": [\"CRG_OPENAI_API_KEY\", \"CRG_OPENAI_BASE_URL\", \"CRG_OPENAI_MODEL\"]}\nfor var in REQUIRED.get(provider, []):\n    if not os.environ.get(var):\n        raise RuntimeError(f\"{var} missing; refresh would fail\")","typeGuard":null,"tryCatchPattern":"try:\n    refresh_embeddings(gs, provider=p, model=m)\nexcept RuntimeError as e:\n    if \"unavailable in this environment\" in str(e):\n        log.error(\"export the provider's API key before refresh\")\n        raise\n    raise","preventionTips":["Run the same env preflight for refresh as for initial embed","Keep embed and refresh in environments with identical secrets","Fail fast on unavailable providers rather than catching and skipping"],"tags":["embeddings","refresh","env-var","provider-unavailable"],"backgroundTag":"missing-env-var","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}