{"record":{"id":"e07b510be18f8d2a","repo":"tirth8205/code-review-graph","slug":"voyage-api-returned-mixed-indexed-unindexed-data","errorCode":null,"errorMessage":"Voyage API returned mixed indexed/unindexed data — refusing to misalign vectors.","messagePattern":"Voyage API returned mixed indexed/unindexed data — refusing to misalign vectors\\.","errorType":"http","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"code_review_graph/embeddings.py","lineNumber":770,"sourceCode":"                if all_int_index:\n                    expected = set(range(len(texts)))\n                    indices = [int(item[\"index\"]) for item in data]\n                    if len(set(indices)) != len(indices) or set(indices) != expected:\n                        raise RuntimeError(\n                            \"Voyage API returned malformed indices \"\n                            f\"(got {indices}, expected permutation of \"\n                            f\"0..{len(texts) - 1}) — refusing to misalign vectors.\"\n                        )\n                    data = sorted(data, key=lambda item: int(item[\"index\"]))\n                elif not any_has_index:\n                    if len(data) != len(texts):\n                        raise RuntimeError(\n                            f\"Voyage API returned {len(data)} embeddings for \"\n                            f\"{len(texts)} inputs with no index field — \"\n                            \"refusing to misalign vectors.\"\n                        )\n                else:\n                    raise RuntimeError(\n                        \"Voyage API returned mixed indexed/unindexed data — \"\n                        \"refusing to misalign vectors.\"\n                    )\n\n                return [item[\"embedding\"] for item in data]\n\n            except Exception as e:\n                is_retryable = False\n                if isinstance(e, urllib.error.HTTPError):\n                    is_retryable = e.code == 429 or 500 <= e.code < 600\n                elif isinstance(e, (\n                    urllib.error.URLError,\n                    socket.timeout,\n                    TimeoutError,\n                    ConnectionError,\n                    ssl.SSLError,\n                    http.client.IncompleteRead,\n                    http.client.BadStatusLine,","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/embeddings.py#L752-L788","documentation":"Some response items have an 'index' field and others do not. Neither the sort-by-index path nor the positional path is safe, so the provider aborts to avoid vector/text misalignment.","triggerScenarios":"Calling embed() where the API (or an intermediary) returns a partially-transformed payload — some items passed through with index, some rewritten without it.","commonSituations":"An OpenAI-compatible proxy that rewrites only some items, mixed caching layers, or API version drift mid-rollout.","solutions":["Remove/fix any CRG_VOYAGE_BASE_URL proxy that rewrites response bodies","Retry — rollouts are often transient","Pin a known-good model/version in CRG_VOYAGE_MODEL","Report with the raw response captured via logging"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"null","typeGuard":null,"tryCatchPattern":"try:\n    vecs = provider.embed(texts)\nexcept RuntimeError as e:\n    if \"mixed indexed/unindexed\" in str(e):\n        vecs = provider.embed(texts)\n    else:\n        raise","preventionTips":["Pin a stable API endpoint/model","Remove response-rewriting middlewares from the embedding path","Never catch-and-continue on misalignment errors; they indicate data corruption"],"tags":["voyage","embeddings","data-integrity","mixed-response"],"backgroundTag":"embedding-response-misalignment","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}