juanfont/headscale · error

%s http client is nil

Error message

%s http client is nil

What it means

Error "%s http client is nil" thrown in juanfont/headscale.

Source

Thrown at integration/scenario.go:1160

	}

	body, _, err := doLoginURLWithClient(hostname, loginURL, hc, true)
	if err != nil {
		return "", err
	}

	return body, nil
}

// doLoginURLWithClient performs the login request using the provided HTTP client.
// When followRedirects is false, it will return the first redirect without following it.
func doLoginURLWithClient(hostname string, loginURL *url.URL, hc *http.Client, followRedirects bool) (
	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 {

View on GitHub (pinned to 565fd254d0)

Solutions

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

When it happens

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

Common situations: The node's HTTP client was not initialized before the login flow. Ensure the tailscale client container is created and running first.


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