router-for-me/CLIProxyAPI · error

response exceeds maximum allowed size of %d bytes

Error message

response exceeds maximum allowed size of %d bytes

What it means

Error "response exceeds maximum allowed size of %d bytes" thrown in router-for-me/CLIProxyAPI.

Source

Thrown at internal/httpfetch/httpfetch.go:59

			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. Request a smaller resource or raise the maximum allowed size if appropriate.
  2. Verify the upstream is returning the expected content and not an error page.

When it happens

Trigger: Thrown at internal/httpfetch/httpfetch.go:59 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/49e4cd1dc5f27c32. Report an issue: GitHub.