router-for-me/CLIProxyAPI · error

read response: %w

Error message

read response: %w

What it means

Error "read response: %w" thrown in router-for-me/CLIProxyAPI.

Source

Thrown at internal/httpfetch/httpfetch.go:56

	}
	defer func() {
		if errClose := resp.Body.Close(); errClose != nil {
			log.WithError(errClose).Debug("failed to close response body")
		}
	}()

	if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
		body, _ := io.ReadAll(io.LimitReader(resp.Body, 4096))
		return nil, fmt.Errorf("unexpected status %d: %s", resp.StatusCode, strings.TrimSpace(string(body)))
	}

	reader := io.Reader(resp.Body)
	if maxSize > 0 {
		reader = io.LimitReader(resp.Body, maxSize+1)
	}
	data, errRead := io.ReadAll(reader)
	if errRead != nil {
		return nil, fmt.Errorf("read response: %w", errRead)
	}
	if maxSize > 0 && int64(len(data)) > maxSize {
		return nil, fmt.Errorf("response exceeds maximum allowed size of %d bytes", maxSize)
	}
	return data, nil
}

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Retry the request; the response body could not be read completely.
  2. Check for network interruptions or an early-closing upstream.

When it happens

Trigger: Thrown at internal/httpfetch/httpfetch.go:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/a65c08d833347e78. Report an issue: GitHub.