{"record":{"id":"815a9b15e5d56e1d","repo":"netbirdio/netbird","slug":"failed-initializing-log-v-815a9b","errorCode":null,"errorMessage":"failed initializing log %v","messagePattern":"failed initializing log (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/cmd/up.go","lineNumber":103,"sourceCode":"\t\t\t`or --extra-dns-labels \"\"`,\n\t)\n\n\tupCmd.PersistentFlags().BoolVar(&noBrowser, noBrowserFlag, false, noBrowserDesc)\n\tupCmd.PersistentFlags().BoolVar(&showQR, showQRFlag, false, showQRDesc)\n\tupCmd.PersistentFlags().StringVar(&profileName, profileNameFlag, \"\", profileNameDesc)\n\tupCmd.PersistentFlags().StringVarP(&configPath, \"config\", \"c\", \"\", \"(DEPRECATED) NetBird config file location. \")\n\n}\n\nfunc upFunc(cmd *cobra.Command, args []string) error {\n\tSetFlagsFromEnvVars(rootCmd)\n\tSetFlagsFromEnvVars(cmd)\n\n\tcmd.SetOut(cmd.OutOrStdout())\n\n\terr := util.InitLog(logLevel, util.LogConsole)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed initializing log %v\", err)\n\t}\n\n\terr = validateNATExternalIPs(natExternalIPs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdnsLabelsValidated, err = validateDnsLabels(dnsLabels)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx := internal.CtxInitState(cmd.Context())\n\n\tif hostName != \"\" {\n\t\t// nolint\n\t\tctx = context.WithValue(ctx, system.DeviceNameCtxKey, hostName)\n\t}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/up.go#L85-L121","documentation":"Thrown by upFunc (client/cmd/up.go:103). util.InitLog(logLevel, util.LogConsole) calls logrus.ParseLevel on the --log-level flag value and returns 'failed parsing log-level ...' when it is not one of logrus's level names (trace, debug, info, warn/warning, error, fatal, panic - case-insensitive). 'netbird up' aborts before any network action.","triggerScenarios":"'netbird up --log-level verbose' or --log-level notice, --log-level 3, or any string logrus does not recognize. Also NB_LOG_LEVEL-style env vars if wired via SetFlagsFromEnvVars.","commonSituations":"Habitual levels from other ecosystems (verbose, notice, all); numeric levels; a typo in wrapper scripts or systemd unit Environment= lines.","solutions":["Use a supported level: trace, debug, info, warn, error, fatal, or panic (debug/info are the common ones)","Remove the --log-level flag to use the default","Check any env var or systemd unit that injects the level for typos"],"exampleFix":"// before\nerr := util.InitLog(logLevel, util.LogConsole)\nif err != nil {\n    return fmt.Errorf(\"failed initializing log %v\", err)\n}\n\n// after: validate early with an actionable message\nif _, perr := logrus.ParseLevel(logLevel); perr != nil {\n    return fmt.Errorf(\"invalid --log-level %q (valid: trace,debug,info,warn,error,fatal,panic)\", logLevel)\n}","handlingStrategy":"validation","validationCode":"if _, err := logrus.ParseLevel(logLevel); err != nil {\n    log.Fatalf(\"--log-level must be one of trace|debug|info|warn|error|fatal|panic, got %q\", logLevel)\n}","typeGuard":"func isValidLogLevel(s string) bool {\n    _, err := logrus.ParseLevel(s)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Use 'debug' or 'info'; avoid ecosystem-specific levels like verbose/notice","Check systemd unit Environment= lines and env vars that inject the level"],"tags":["cli","logging","validation","user-input","netbird"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}