netbirdio/netbird · warning
failed initializing log %v
Error message
failed initializing log %v
What it means
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.
Source
Thrown at client/cmd/up.go:103
`or --extra-dns-labels ""`,
)
upCmd.PersistentFlags().BoolVar(&noBrowser, noBrowserFlag, false, noBrowserDesc)
upCmd.PersistentFlags().BoolVar(&showQR, showQRFlag, false, showQRDesc)
upCmd.PersistentFlags().StringVar(&profileName, profileNameFlag, "", profileNameDesc)
upCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "(DEPRECATED) NetBird config file location. ")
}
func upFunc(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars(rootCmd)
SetFlagsFromEnvVars(cmd)
cmd.SetOut(cmd.OutOrStdout())
err := util.InitLog(logLevel, util.LogConsole)
if err != nil {
return fmt.Errorf("failed initializing log %v", err)
}
err = validateNATExternalIPs(natExternalIPs)
if err != nil {
return err
}
dnsLabelsValidated, err = validateDnsLabels(dnsLabels)
if err != nil {
return err
}
ctx := internal.CtxInitState(cmd.Context())
if hostName != "" {
// nolint
ctx = context.WithValue(ctx, system.DeviceNameCtxKey, hostName)
}View on GitHub (pinned to 93e97f4bf1)
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
Example fix
// before
err := util.InitLog(logLevel, util.LogConsole)
if err != nil {
return fmt.Errorf("failed initializing log %v", err)
}
// after: validate early with an actionable message
if _, perr := logrus.ParseLevel(logLevel); perr != nil {
return fmt.Errorf("invalid --log-level %q (valid: trace,debug,info,warn,error,fatal,panic)", logLevel)
} Defensive patterns
Strategy: validation
Validate before calling
if _, err := logrus.ParseLevel(logLevel); err != nil {
log.Fatalf("--log-level must be one of trace|debug|info|warn|error|fatal|panic, got %q", logLevel)
} Type guard
func isValidLogLevel(s string) bool {
_, err := logrus.ParseLevel(s)
return err == nil
} Prevention
- Use 'debug' or 'info'; avoid ecosystem-specific levels like verbose/notice
- Check systemd unit Environment= lines and env vars that inject the level
When it happens
Trigger: '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.
Common situations: Habitual levels from other ecosystems (verbose, notice, all); numeric levels; a typo in wrapper scripts or systemd unit Environment= lines.
Related errors
- invalid direction: use 'in' or 'out'
- invalid protocol: use tcp/udp/icmp
- invalid source port: %v
- invalid destination port: %v
- unknown log level: %s. Available levels are: panic, fatal, e
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/815a9b15e5d56e1d.
Report an issue: GitHub.