{"record":{"id":"18f0b2cfed62d8f3","repo":"netbirdio/netbird","slug":"set-env-and-flags-v","errorCode":null,"errorMessage":"set env and flags: %v","messagePattern":"set env and flags: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/login.go","lineNumber":47,"sourceCode":"// refresh an SSO-tracked peer — see auth.errSetupKeyOnSSOExpiredPeer).\nvar extendSessionFlag bool\n\nfunc init() {\n\tloginCmd.PersistentFlags().BoolVar(&noBrowser, noBrowserFlag, false, noBrowserDesc)\n\tloginCmd.PersistentFlags().BoolVar(&showQR, showQRFlag, false, showQRDesc)\n\tloginCmd.PersistentFlags().StringVar(&profileName, profileNameFlag, \"\", profileNameDesc)\n\tloginCmd.PersistentFlags().StringVarP(&configPath, \"config\", \"c\", \"\", \"(DEPRECATED) Netbird config file location\")\n\tloginCmd.PersistentFlags().BoolVar(&extendSessionFlag, \"extend\", false,\n\t\t\"refresh the SSO session expiry without tearing down the tunnel (requires an active connection)\")\n}\n\nvar loginCmd = &cobra.Command{\n\tUse:   \"login\",\n\tShort: \"Log in to the NetBird network\",\n\tLong:  \"Log in to the NetBird network using a setup key or SSO\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tif err := setEnvAndFlags(cmd); err != nil {\n\t\t\treturn fmt.Errorf(\"set env and flags: %v\", err)\n\t\t}\n\n\t\tctx := internal.CtxInitState(context.Background())\n\n\t\tif hostName != \"\" {\n\t\t\t// nolint\n\t\t\tctx = context.WithValue(ctx, system.DeviceNameCtxKey, hostName)\n\t\t}\n\t\tusername, err := user.Current()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"get current user: %v\", err)\n\t\t}\n\n\t\tpm := profilemanager.NewProfileManager()\n\n\t\tactiveProf, err := getActiveProfile(cmd.Context(), pm, profileName, username.Username)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"get active profile: %v\", err)","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/login.go#L29-L65","documentation":"Error \"set env and flags: %v\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/cmd/login.go:47 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"}