weaviate/weaviate · error

unmarshal meta response body

Error message

unmarshal meta response body

What it means

This error is wrapped around json.Unmarshal when parsing the HTTP response body from the reranker-transformers service's /meta endpoint. The MetaInfo call expects a JSON object (map[string]interface{}); if the body is not valid JSON or is not an object, this error is thrown. It indicates the inference container returned malformed or unexpected content.

Source

Thrown at modules/reranker-transformers/clients/ranker_meta.go:42

	req, err := http.NewRequestWithContext(context.Background(), "GET", s.url("/meta"), nil)
	if err != nil {
		return nil, errors.Wrap(err, "create GET meta request")
	}

	res, err := s.httpClient.Do(req)
	if err != nil {
		return nil, errors.Wrap(err, "send GET meta request")
	}
	defer res.Body.Close()

	bodyBytes, err := io.ReadAll(res.Body)
	if err != nil {
		return nil, errors.Wrap(err, "read meta response body")
	}

	var resBody map[string]interface{}
	if err := json.Unmarshal(bodyBytes, &resBody); err != nil {
		return nil, errors.Wrap(err, "unmarshal meta response body")
	}
	return resBody, nil
}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Verify the URL in RANKER_TRANSFORMERS_INFERENCE_URL resolves to the reranker-transformers inference container, not another service or proxy.
  2. Curl the /.well-known/ready and /meta endpoints directly from inside the cluster/network to inspect the raw response.
  3. Check reranker-transformers container logs for panics or route changes and ensure the container version is compatible with your Weaviate version.
  4. Retry after fixing: MetaInfo failures here are usually environmental, not a Weaviate code bug.

Example fix

// before (misconfigured)
RANKER_TRANSFORMERS_INFERENCE_URL=http://localhost:9999
// after
RANKER_TRANSFORMERS_INFERENCE_URL=http://reranker-transformers:8080
Defensive patterns

Strategy: validation

Validate before calling

resp, err := http.Get(metaURL)
if err != nil { return err }
body, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
resp.Body.Close()
var probe map[string]interface{}
if err := json.Unmarshal(body, &probe); err != nil {
    return fmt.Errorf("meta endpoint did not return valid JSON object (status %d): %s", resp.StatusCode, string(body[:min(len(body),200)]))
}

Type guard

func isJSONObject(b []byte) bool {
    var v map[string]interface{}
    return json.Unmarshal(b, &v) == nil
}

Prevention

When it happens

Trigger: The /meta endpoint returns HTML (e.g. a proxy error page or 404 page), an empty body, truncated JSON, or a JSON array/string instead of an object. Also occurs when a wrong URL points at a non-inference service.

Common situations: Misconfigured RANKER_TRANSFORMERS_INFERENCE_URL pointing to the wrong port or service, a reverse proxy returning an error page, an outdated or incompatible reranker-transformers container version whose /meta route changed, or network middleware intercepting the request.

Understand the failure class

Background: "Invalid JSON response" and "Failed to parse response" errors: when an API answers 200 but the body isn't the JSON your library expected — this error's family across 28 libraries.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/411faa148323dc0e. Report an issue: GitHub.