juanfont/headscale · warning

unknown --set value (want must|all)

Error message

unknown --set value (want must|all)

What it means

Wrapped error from doLoginURLWithClient when http.NewRequestWithContext fails to build the GET request for the login URL. This only happens on malformed URLs (unparseable by url.Parse after the URL was already stringified) or an invalid method/context — all unlikely because loginURL came from url.URL.

Source

Thrown at cmd/hi/listversions.go:14

package main

import (
	"encoding/json"
	"errors"
	"fmt"
	"strings"

	"github.com/creachadair/command"
	"github.com/juanfont/headscale/hscontrol/capver"
)

var (
	errUnknownSet    = errors.New("unknown --set value (want must|all)")
	errUnknownFormat = errors.New("unknown --format value (want space|newline|json)")
)

// ListVersionsConfig holds flags for the list-versions subcommand.
type ListVersionsConfig struct {
	Set     string `flag:"set,default=must,Version set: must|all"`
	Exclude string `flag:"exclude,Comma-separated versions to exclude (e.g. head,unstable)"`
	Format  string `flag:"format,default=space,Output format: space|newline|json"`
}

var listVersionsConfig ListVersionsConfig

// listVersions prints the Tailscale versions used by integration tests
// in a format CI can shell out to. Mirrors integration/scenario.go
// AllVersions and MustTestVersions: "head" and "unstable" are bare
// tags, releases get a "v" prefix so each entry can be appended to
// "ghcr.io/tailscale/tailscale:" directly.
func listVersions(env *command.Env) error {

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Log loginURL.String() and validate it parses (url.Parse) before calling.
  2. Fix the source producing the malformed URL — usually the OIDC provider or redirect handling upstream.
Defensive patterns

Strategy: validation

Validate before calling

raw := loginURL.String()
if _, err := url.Parse(raw); err != nil {
    return fmt.Errorf("login URL unparseable: %q: %w", raw, err)
}

Prevention

When it happens

Trigger: loginURL.String() producing a URL that NewRequestWithContext rejects — e.g. a URL containing control characters or an empty scheme after redirect handling.

Common situations: A redirect Location header carried a relative or malformed URL that was stored in a *url.URL inconsistently; control characters injected into the URL by a mock/broken OIDC provider in tests.

Related errors


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