{"record":{"id":"4d6958c6e68c2dc2","repo":"juanfont/headscale","slug":"getting-clients-w","errorCode":null,"errorMessage":"getting clients: %w","messagePattern":"getting clients: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integration/scenario.go","lineNumber":1426,"sourceCode":"\t\t\t\treturn ips, fmt.Errorf(\"getting IPs: %w\", err)\n\t\t\t}\n\n\t\t\tips = append(ips, clientIps...)\n\t\t}\n\n\t\treturn ips, nil\n\t}\n\n\treturn ips, fmt.Errorf(\"getting IPs: %w\", errNoUserAvailable)\n}\n\n// GetClients returns all [TailscaleClient]s associated with a [User] in a [Scenario].\nfunc (s *Scenario) GetClients(user string) ([]TailscaleClient, error) {\n\tif ns, ok := s.users[user]; ok {\n\t\treturn xmaps.Values(ns.Clients), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"getting clients: %w\", errNoUserAvailable)\n}\n\n// ListTailscaleClients returns a list of [TailscaleClient]s given the [User]s\n// passed as parameters.\nfunc (s *Scenario) ListTailscaleClients(users ...string) ([]TailscaleClient, error) {\n\tvar allClients []TailscaleClient\n\n\tif len(users) == 0 {\n\t\tusers = s.Users()\n\t}\n\n\tfor _, user := range users {\n\t\tclients, err := s.GetClients(user)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tallClients = append(allClients, clients...)","sourceCodeStart":1408,"sourceCodeEnd":1444,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/scenario.go#L1408-L1444","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, ok := s.users[user]; !ok { // if accessible; otherwise use s.Users()\n    return fmt.Errorf(\"user %q not in scenario; have %v\", user, s.Users())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact names from Scenario.Users().","Create users through the scenario helper only.","Assert user creation succeeded before listing clients."],"tags":["integration","validation","user-management"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}