tirth8205/code-review-graph · critical · RuntimeError

Voyage API returned mixed indexed/unindexed data — refusing

Error message

Voyage API returned mixed indexed/unindexed data — refusing to misalign vectors.

What it means

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.

Source

Thrown at code_review_graph/embeddings.py:770

                if all_int_index:
                    expected = set(range(len(texts)))
                    indices = [int(item["index"]) for item in data]
                    if len(set(indices)) != len(indices) or set(indices) != expected:
                        raise RuntimeError(
                            "Voyage API returned malformed indices "
                            f"(got {indices}, expected permutation of "
                            f"0..{len(texts) - 1}) — refusing to misalign vectors."
                        )
                    data = sorted(data, key=lambda item: int(item["index"]))
                elif not any_has_index:
                    if len(data) != len(texts):
                        raise RuntimeError(
                            f"Voyage API returned {len(data)} embeddings for "
                            f"{len(texts)} inputs with no index field — "
                            "refusing to misalign vectors."
                        )
                else:
                    raise RuntimeError(
                        "Voyage API returned mixed indexed/unindexed data — "
                        "refusing to misalign vectors."
                    )

                return [item["embedding"] for item in data]

            except Exception as e:
                is_retryable = False
                if isinstance(e, urllib.error.HTTPError):
                    is_retryable = e.code == 429 or 500 <= e.code < 600
                elif isinstance(e, (
                    urllib.error.URLError,
                    socket.timeout,
                    TimeoutError,
                    ConnectionError,
                    ssl.SSLError,
                    http.client.IncompleteRead,
                    http.client.BadStatusLine,

View on GitHub (pinned to b58668751a)

Solutions

  1. Remove/fix any CRG_VOYAGE_BASE_URL proxy that rewrites response bodies
  2. Retry — rollouts are often transient
  3. Pin a known-good model/version in CRG_VOYAGE_MODEL
  4. Report with the raw response captured via logging
Defensive patterns

Strategy: retry

Validate before calling

null

Try / catch

try:
    vecs = provider.embed(texts)
except RuntimeError as e:
    if "mixed indexed/unindexed" in str(e):
        vecs = provider.embed(texts)
    else:
        raise

Prevention

When it happens

Trigger: Calling embed() where the API (or an intermediary) returns a partially-transformed payload — some items passed through with index, some rewritten without it.

Common situations: An OpenAI-compatible proxy that rewrites only some items, mixed caching layers, or API version drift mid-rollout.

Related errors


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