{"record":{"id":"02083d47cbd8bbfe","repo":"netbirdio/netbird","slug":"get-current-user-v-02083d","errorCode":null,"errorMessage":"get current user: %v","messagePattern":"get current user: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/cmd/login.go","lineNumber":58,"sourceCode":"\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)\n\t\t}\n\n\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}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/login.go#L40-L76","documentation":"Error \"get current user: %v\" thrown in netbirdio/netbird.","triggerScenarios":"Thrown at client/cmd/login.go:58 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"}