juanfont/headscale · error

%s creating http request: %w

Error message

%s creating http request: %w

What it means

Error "%s creating http request: %w" thrown in juanfont/headscale.

Source

Thrown at integration/scenario.go:1173

	string,
	*url.URL,
	error,
) {
	if hc == nil {
		return "", nil, fmt.Errorf("%s http client is nil", hostname) //nolint:err113
	}

	if loginURL == nil {
		return "", nil, fmt.Errorf("%s login url is nil", hostname) //nolint:err113
	}

	log.Printf("%s logging in with url: %s", hostname, loginURL.String())

	ctx := context.Background()

	req, err := http.NewRequestWithContext(ctx, http.MethodGet, loginURL.String(), nil)
	if err != nil {
		return "", nil, fmt.Errorf("%s creating http request: %w", hostname, err)
	}

	originalRedirect := hc.CheckRedirect
	if !followRedirects {
		hc.CheckRedirect = func(req *http.Request, via []*http.Request) error {
			return http.ErrUseLastResponse
		}
	}

	defer func() {
		hc.CheckRedirect = originalRedirect
	}()

	resp, err := hc.Do(req)
	if err != nil {
		return "", nil, fmt.Errorf("%s sending http request: %w", hostname, err)
	}
	defer resp.Body.Close()

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Inspect the wrapped error for the underlying cause and correct the failing condition (creating http request); retry the operation after fixing the input, configuration, or environment.

Example fix

Inspect the wrapped error for the underlying cause and correct the failing condition (creating http request); retry the operation after fixing the input, configuration, or environment.

When it happens

Trigger: Thrown at integration/scenario.go:1173 when the library encounters an invalid state.

Common situations: Building the HTTP request for the OIDC login flow failed. Check the login URL is well-formed.


AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15). Data as JSON: /api/errors/62aa5fd690959e83. Report an issue: GitHub.