{"record":{"id":"e263219afc1c5bd4","repo":"netbirdio/netbird","slug":"foreground-login-failed-v","errorCode":null,"errorMessage":"foreground login failed: %v","messagePattern":"foreground login failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/login.go","lineNumber":86,"sourceCode":"\t\tprovidedSetupKey, err := getSetupKey()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif extendSessionFlag {\n\t\t\tif providedSetupKey != \"\" {\n\t\t\t\treturn fmt.Errorf(\"--extend cannot be combined with a setup key; setup keys can only enrol new peers\")\n\t\t\t}\n\t\t\tif err := doExtendSession(ctx, cmd); err != nil {\n\t\t\t\treturn fmt.Errorf(\"extend session failed: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// workaround to run without service\n\t\tif util.FindFirstLogPath(logFiles) == \"\" {\n\t\t\tif err := doForegroundLogin(ctx, cmd, providedSetupKey, activeProf); err != nil {\n\t\t\t\treturn fmt.Errorf(\"foreground login failed: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := doDaemonLogin(ctx, cmd, providedSetupKey, activeProf, username.Username, pm); err != nil {\n\t\t\treturn fmt.Errorf(\"daemon login failed: %v\", err)\n\t\t}\n\n\t\tcmd.Println(\"Logging successfully\")\n\n\t\treturn nil\n\t},\n}\n\nfunc doDaemonLogin(ctx context.Context, cmd *cobra.Command, providedSetupKey string, activeProf *profilemanager.Profile, username string, pm *profilemanager.ProfileManager) error {\n\tconn, err := DialClientGRPCServer(ctx, daemonAddr)\n\tif err != nil {\n\t\t//nolint","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/login.go#L68-L104","documentation":"Error \"foreground login failed: %v\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/cmd/login.go:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}