juanfont/headscale · error

%s sending http request: %w

Error message

%s sending http request: %w

What it means

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

Source

Thrown at integration/scenario.go:1189

	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()

	bodyBytes, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", nil, fmt.Errorf("%s reading response body: %w", hostname, err)
	}

	body := string(bodyBytes)

	var redirectURL *url.URL
	if resp.StatusCode >= http.StatusMultipleChoices && resp.StatusCode < http.StatusBadRequest {
		redirectURL, err = resp.Location()
		if err != nil {
			return body, nil, fmt.Errorf("%s resolving redirect location: %w", hostname, err)
		}
	}

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Inspect the wrapped error for the underlying cause and correct the failing condition (sending 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 (sending http request); retry the operation after fixing the input, configuration, or environment.

When it happens

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

Common situations: Sending the login HTTP request failed. Check network connectivity between the test container and the OIDC provider container.


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