{"record":{"id":"0dfdb1d4917a34d7","repo":"cli/cli","slug":"not-logged-in-to-s-account-s-0dfdb1","errorCode":null,"errorMessage":"not logged in to %s account %s","messagePattern":"not logged in to (.+?) account (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/auth/switch/switch.go","lineNumber":100,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tauthCfg := cfg.Authentication()\n\n\tknownHosts := authCfg.Hosts()\n\tif len(knownHosts) == 0 {\n\t\treturn fmt.Errorf(\"not logged in to any hosts\")\n\t}\n\n\tif hostname != \"\" {\n\t\tif !slices.Contains(knownHosts, hostname) {\n\t\t\treturn fmt.Errorf(\"not logged in to %s\", hostname)\n\t\t}\n\n\t\tif username != \"\" {\n\t\t\tknownUsers := cfg.Authentication().UsersForHost(hostname)\n\t\t\tif !slices.Contains(knownUsers, username) {\n\t\t\t\treturn fmt.Errorf(\"not logged in to %s account %s\", hostname, username)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar candidates candidates\n\n\tfor _, host := range knownHosts {\n\t\tif hostname != \"\" && host != hostname {\n\t\t\tcontinue\n\t\t}\n\t\thostActiveUser, err := authCfg.ActiveUser(host)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tknownUsers := cfg.Authentication().UsersForHost(host)\n\t\tfor _, user := range knownUsers {\n\t\t\tif username != \"\" && user != username {\n\t\t\t\tcontinue","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/auth/switch/switch.go#L82-L118","documentation":"Error \"not logged in to %s account %s\" thrown in cli/cli.","triggerScenarios":"Thrown at pkg/cmd/auth/switch/switch.go:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log in as that account with `gh auth login`, or pick one of the accounts shown by `gh auth status`."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eeec0b92edbe70199f9768522f831d3534f41ad","analyzedAt":"2026-08-15T12:31:05.478Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}