router-for-me/CLIProxyAPI · error

create request: %w

Error message

create request: %w

What it means

Error "create request: %w" thrown in router-for-me/CLIProxyAPI.

Source

Thrown at internal/httpfetch/httpfetch.go:27

	log "github.com/sirupsen/logrus"
)

// Doer abstracts the HTTP client used to execute requests.
type Doer interface {
	Do(*http.Request) (*http.Response, error)
}

// GetBytes performs a GET request with the supplied headers, requires a
// success status, and returns the response body. When maxSize is positive
// the body is rejected once it exceeds maxSize bytes.
func GetBytes(ctx context.Context, client Doer, requestURL string, headers map[string]string, maxSize int64) ([]byte, error) {
	if client == nil {
		client = http.DefaultClient
	}
	req, errRequest := http.NewRequestWithContext(ctx, http.MethodGet, requestURL, nil)
	if errRequest != nil {
		return nil, fmt.Errorf("create request: %w", errRequest)
	}
	for key, value := range headers {
		if value != "" {
			req.Header.Set(key, value)
		}
	}

	resp, errDo := client.Do(req)
	if errDo != nil {
		return nil, fmt.Errorf("request failed: %w", errDo)
	}
	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 {

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Verify the target URL is valid and the HTTP client is initialized.
  2. Check the wrapped error for request construction details.

When it happens

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