{"record":{"id":"1b4d93aa398d0716","repo":"tirth8205/code-review-graph","slug":"voyage-api-returned-empty-data","errorCode":null,"errorMessage":"Voyage API returned empty data","messagePattern":"Voyage API returned empty data","errorType":"http","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"code_review_graph/embeddings.py","lineNumber":746,"sourceCode":"                                err_obj.get(\"message\", err_msg)\n                                if isinstance(err_obj, dict) else str(err_obj)\n                            )\n                    except Exception:  # nosec B110\n                        pass\n                    raise RuntimeError(\n                        f\"Voyage API HTTP {http_err.code}: {err_msg}\"\n                    ) from http_err\n\n                response = _json.loads(raw)\n\n                if \"error\" in response:\n                    err = response[\"error\"]\n                    msg = err.get(\"message\", \"unknown\") if isinstance(err, dict) else str(err)\n                    raise RuntimeError(f\"Voyage API error: {msg}\")\n\n                data = response.get(\"data\", [])\n                if not data:\n                    raise RuntimeError(\"Voyage API returned empty data\")\n\n                any_has_index = any(\"index\" in item for item in data)\n                all_int_index = all(\n                    isinstance(item.get(\"index\"), int) for item in data\n                )\n                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(","sourceCodeStart":728,"sourceCodeEnd":764,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/embeddings.py#L728-L764","documentation":"The Voyage API returned a 200-style response with no 'data' array (or an empty one). The provider refuses to return an empty embedding list because callers assume one vector per input text.","triggerScenarios":"Calling embed()/embed_query() where the parsed Voyage response has no 'data' key or data == [] — server-side truncation, proxy stripping fields, or an empty input batch.","commonSituations":"Misconfigured CRG_VOYAGE_BASE_URL proxy that reformats responses, sending an empty texts list, or transient API anomalies/outage behavior.","solutions":["Log and retry once — often transient","Confirm the request actually included non-empty texts","If using a custom CRG_VOYAGE_BASE_URL, curl the endpoint manually and verify the 'data' array is present","Report to Voyage if reproducible with a minimal request"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if not texts:\n    raise ValueError(\"refusing to call embed() with no texts\")","typeGuard":null,"tryCatchPattern":"try:\n    vecs = provider.embed(texts)\nexcept RuntimeError as e:\n    if \"empty data\" in str(e):\n        vecs = provider.embed(texts)  # one retry\n    else:\n        raise","preventionTips":["Never pass an empty texts list","Keep batches small enough to avoid truncation","Alert on repeated empty-data responses — likely a proxy issue"],"tags":["voyage","embeddings","empty-response"],"backgroundTag":"embedding-api-error","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}