{"record":{"id":"a0f77210e82b46c7","repo":"netbirdio/netbird","slug":"unknown-log-level-s-available-levels-are-panic","errorCode":null,"errorMessage":"unknown log level: %s. Available levels are: panic, fatal, error, warn, info, debug, trace\n","messagePattern":"unknown log level: (.+?)\\. Available levels are: panic, fatal, error, warn, info, debug, trace\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/cmd/debug.go","lineNumber":218,"sourceCode":"\treturn nil\n}\n\nfunc setLogLevel(cmd *cobra.Command, args []string) error {\n\tconn, err := getClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err := conn.Close(); err != nil {\n\t\t\tlog.Errorf(errCloseConnection, err)\n\t\t}\n\t}()\n\n\tclient := proto.NewDaemonServiceClient(conn)\n\tlevel := server.ParseLogLevel(args[0])\n\tif level == proto.LogLevel_UNKNOWN {\n\t\t//nolint\n\t\treturn fmt.Errorf(\"unknown log level: %s. Available levels are: panic, fatal, error, warn, info, debug, trace\\n\", args[0])\n\t}\n\n\t_, err = client.SetLogLevel(cmd.Context(), &proto.SetLogLevelRequest{\n\t\tLevel: level,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to set log level: %v\", status.Convert(err).Message())\n\t}\n\n\tcmd.Println(\"Log level set successfully to\", args[0])\n\treturn nil\n}\n\nfunc runForDuration(cmd *cobra.Command, args []string) error {\n\tduration, err := time.ParseDuration(args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid duration format: %v\", err)\n\t}","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/cmd/debug.go#L200-L236","documentation":"setLogLevel parses the requested level with server.ParseLogLevel, which lowercases the input and maps only panic, fatal, error, warn, info, debug and trace; anything else returns LogLevel_UNKNOWN and this error. The check happens client-side before any RPC, so the daemon was not contacted. Note the mapping is lowercase-insensitive but strictly named — 'warning', 'err', 'verbose', 'none', or an empty string all fail.","triggerScenarios":"netbird debug log-level warning (the canonical name is warn); netbird debug log-level err or ERROR_LEVEL; passing a logrus/zap level name that is not in the list (trace is supported, 'fatal' is, 'panic' is, but 'all'/'off' are not); quoting issues leaving an empty argument.","commonSituations":"Users assuming the log levels of the underlying logging library carry over (logrus uses warn but people type warning; some tools use notice/emerg); scripts parameterized from a config that stores a different level vocabulary; muscle memory from netbird up --log-level? — the accepted set is identical, but typos still trip it.","solutions":["Use one of the exact names from the message: panic, fatal, error, warn, info, debug, trace (case-insensitive)","For 'warning' type 'warn'; for 'err' type 'error'; for 'off/all' there is no equivalent — choose trace (most verbose) or a higher level","Quote the argument exactly once and confirm it is non-empty: netbird debug log-level 'debug'"],"exampleFix":"# before\nnetbird debug log-level warning\n# -> unknown log level: warning. ...\n\n# after\nnetbird debug log-level warn","handlingStrategy":"validation","validationCode":"// Reuse the daemon's parser so validation matches exactly:\nif server.ParseLogLevel(arg) == proto.LogLevel_UNKNOWN {\n    return fmt.Errorf(\"unknown log level: %s\", arg)\n}","typeGuard":"// Go set membership for the accepted vocabulary:\nfunc isValidLogLevel(s string) bool {\n    switch strings.ToLower(s) {\n    case \"panic\", \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Normalize level names in scripts to the seven accepted words before passing them","Map other vocabularies up front: warning->warn, err->error, off/all have no equivalent","Validate config-stored level strings at config load time, not at command time"],"tags":["cli","logging","validation","log-level"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}