juanfont/headscale · error
getting clients: %w
Error message
getting clients: %w
What it means
`Scenario.GetClients(user)` was called with a user name absent from `s.users`; it returns `errNoUserAvailable` wrapped as "getting clients". Same lookup semantics as GetIPs: only users registered in the Scenario resolve.
Source
Thrown at integration/scenario.go:1426
return ips, fmt.Errorf("getting IPs: %w", err)
}
ips = append(ips, clientIps...)
}
return ips, nil
}
return ips, fmt.Errorf("getting IPs: %w", errNoUserAvailable)
}
// GetClients returns all [TailscaleClient]s associated with a [User] in a [Scenario].
func (s *Scenario) GetClients(user string) ([]TailscaleClient, error) {
if ns, ok := s.users[user]; ok {
return xmaps.Values(ns.Clients), nil
}
return nil, fmt.Errorf("getting clients: %w", errNoUserAvailable)
}
// ListTailscaleClients returns a list of [TailscaleClient]s given the [User]s
// passed as parameters.
func (s *Scenario) ListTailscaleClients(users ...string) ([]TailscaleClient, error) {
var allClients []TailscaleClient
if len(users) == 0 {
users = s.Users()
}
for _, user := range users {
clients, err := s.GetClients(user)
if err != nil {
return nil, err
}
allClients = append(allClients, clients...)View on GitHub (pinned to 565fd254d0)
Solutions
- Use `Scenario.Users()` to enumerate valid names and pass one of those.
- Verify the user was created (and the creation error checked) earlier in the test.
- Standardize user-name constants shared between creation and lookup.
Defensive patterns
Strategy: validation
Validate before calling
if _, ok := s.users[user]; !ok { // if accessible; otherwise use s.Users()
return fmt.Errorf("user %q not in scenario; have %v", user, s.Users())
} Prevention
- Use exact names from Scenario.Users().
- Create users through the scenario helper only.
- Assert user creation succeeded before listing clients.
When it happens
Trigger: Any GetClients call whose argument does not exactly match a key in the scenario's user map — unknown user, typo, wrong casing, or user removed by cleanup.
Common situations: Parameterized tests generating user names that were never created; name drift between the creation call and the lookup; test reusing a scenario across subtests that clean users.
Related errors
- test failed
- network does not exist: %s
- no network set, called from: %s
- HEADSCALE_CLI_API_KEY environment variable needs to be set
- unexpected end of container wait
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/4d6958c6e68c2dc2.
Report an issue: GitHub.