{"record":{"id":"cd2d2386781da766","repo":"weaviate/weaviate","slug":"connection-to-voyageai-api-failed-with-status-d-cd2d23","errorCode":null,"errorMessage":"connection to VoyageAI API failed with status %d","messagePattern":"connection to VoyageAI API failed with status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/reranker-voyageai/clients/ranker.go","lineNumber":148,"sourceCode":"\t\treturn nil, errors.Wrap(err, \"send POST request\")\n\t}\n\tdefer res.Body.Close()\n\n\tbodyBytes, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"read response body\")\n\t}\n\n\tif res.StatusCode != 200 {\n\t\tvar apiError voyageAiApiError\n\t\terr = json.Unmarshal(bodyBytes, &apiError)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"unmarshal error from response body\")\n\t\t}\n\t\tif apiError.Message != \"\" {\n\t\t\treturn nil, errors.Errorf(\"connection to VoyageAI API failed with status %d: %s\", res.StatusCode, apiError.Message)\n\t\t}\n\t\treturn nil, errors.Errorf(\"connection to VoyageAI API failed with status %d\", res.StatusCode)\n\t}\n\n\tvar rankResponse RankResponse\n\tif err := json.Unmarshal(bodyBytes, &rankResponse); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse reranker response (status %d): %w\", res.StatusCode, err)\n\t}\n\treturn c.toDocumentScores(documents, rankResponse.Data), nil\n}\n\nfunc (c *client) chunkDocuments(documents []string, chunkSize int) [][]string {\n\tvar requests [][]string\n\tfor i := 0; i < len(documents); i += chunkSize {\n\t\tend := i + chunkSize\n\n\t\tif end > len(documents) {\n\t\t\tend = len(documents)\n\t\t}\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/modules/reranker-voyageai/clients/ranker.go#L130-L166","documentation":"The VoyageAI rerank API returned a non-2xx HTTP status but the response body either failed to parse as an error object or had an empty `message` field, so Weaviate reports only the status code. It indicates an upstream rejection whose details were not exposed in the expected format.","triggerScenarios":"performRank received e.g. 401/429/500 from api.voyageai.com with an empty body, an HTML error page (proxy/gateway), or a JSON body lacking the `message` field.","commonSituations":"Corporate proxies or API gateways returning HTML error pages; VoyageAI returning empty-bodied 5xx during incidents; rate-limit responses without a JSON message.","solutions":["Check VoyageAI service status for incidents causing bare 5xx responses","Inspect any proxy/load balancer between Weaviate and the internet that may strip or replace response bodies","Validate the configured API key and model with a direct curl call to see the real status","Retry with backoff for 429/5xx; fix credentials for 401/403"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"func preflightVoyageai(ctx context.Context, apiKey string) error {\n  if apiKey == \"\" { return errors.New(\"VOYAGEAI_APIKEY is not set\") }\n  req, _ := http.NewRequestWithContext(ctx, http.MethodGet, \"https://api.voyageai.com/v1/models\", nil)\n  req.Header.Set(\"Authorization\", \"Bearer \"+apiKey)\n  res, err := http.DefaultClient.Do(req)\n  if err != nil { return err }\n  defer res.Body.Close()\n  io.Copy(io.Discard, res.Body)\n  if res.StatusCode >= 400 { return fmt.Errorf(\"voyageai preflight failed: %d\", res.StatusCode) }\n  return nil\n}","typeGuard":null,"tryCatchPattern":"results, err := voyageClient.Rank(ctx, query, docs)\nif err != nil {\n  if isRetryable(err) { // 429/5xx per the status text\n    return withBackoff(func() error { _, err = voyageClient.Rank(ctx, query, docs); return err })\n  }\n  return fmt.Errorf(\"rerank failed without upstream detail: %w\", err)\n}","preventionTips":["Set proxy env vars correctly so upstream error bodies aren't replaced by gateway HTML","Monitor VoyageAI status for bare 5xx incidents","Retry 429/5xx with exponential backoff","Log the full response when this occurs to capture missing-body conditions"],"tags":["voyageai","reranker","http-error","empty-response"],"backgroundTag":"voyageai-api-request-failed","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}