weaviate/weaviate · error

read response body

Error message

read response body

What it means

Wraps an io.ReadAll failure while draining the Databricks HTTP response body. After a successful HTTP exchange, the response stream could not be read to completion — usually a mid-stream disconnect, body already closed/consumed, or context cancellation during read. No parsed result is produced even though the server may have generated output.

Source

Thrown at modules/generative-databricks/clients/databricks.go:117

	apiKey, err := v.getApiKey(ctx)
	if err != nil {
		return nil, errors.Wrapf(err, "Databricks Token")
	}
	req.Header.Add(v.getApiKeyHeaderAndValue(apiKey))
	req.Header.Add("Content-Type", "application/json")
	if userAgent := modulecomponents.GetValueFromContext(ctx, "X-Databricks-User-Agent"); userAgent != "" {
		req.Header.Add("User-Agent", userAgent)
	}

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

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

	var resBody generateResponse
	if err := json.Unmarshal(bodyBytes, &resBody); err != nil {
		return nil, fmt.Errorf("failed to parse generative response (status %d): %w", res.StatusCode, err)
	}

	if res.StatusCode != 200 || resBody.Error != nil {
		return nil, v.getError(res.StatusCode, resBody.Error)
	}

	responseParams := v.getResponseParams(resBody.Usage)
	textResponse := resBody.Choices[0].Text
	if len(resBody.Choices) > 0 && textResponse != "" {
		trimmedResponse := strings.Trim(textResponse, "\n")
		return &modulecapabilities.GenerateResponse{
			Result: &trimmedResponse,
			Debug:  debugInformation,

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Check the inner error: 'unexpected EOF'/connection reset → retry; 'context canceled' → raise your client timeout.
  2. Reduce prompt size / maxTokens so the response completes before any intermediary timeout.
  3. Increase proxy/LB read timeouts (e.g. nginx proxy_read_timeout) between weaviate and Databricks.
  4. Retry the request; these are typically transient.
  5. Check Databricks workspace status for server-side stream failures.
Defensive patterns

Strategy: retry

Try / catch

// Go
_, err := collection.Generate(ctx, prompt, nil)
if err != nil && strings.Contains(err.Error(), "read response body") {
    if errors.Is(err, io.ErrUnexpectedEOF) || strings.Contains(err.Error(), "connection reset") {
        // transient — retry with backoff and a smaller maxTokens
    }
    if errors.Is(err, context.Canceled) {
        // client gave up — increase client timeout instead of retrying
    }
}

Prevention

When it happens

Trigger: Databricks closes the connection while the body is streaming; an intermediary (LB/proxy) resets the connection; the request context is canceled mid-read; response body truncated by network issues.

Common situations: Long-running generations over unstable links; reverse proxies with aggressive read timeouts (nginx proxy_read_timeout); Databricks server-side timeouts on very large prompts; flaky VPN/egress.

Related errors


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