{"record":{"id":"4fd67f01df03a973","repo":"gotify/server","slug":"unknown-log-level","errorCode":null,"errorMessage":"unknown log level","messagePattern":"unknown log level","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"config/loglevel.go","lineNumber":19,"sourceCode":"package config\n\nimport (\n\t\"errors\"\n\n\t\"github.com/rs/zerolog\"\n)\n\n// LogLevel type that provides helper methods for decoding.\ntype LogLevel zerolog.Level\n\n// Decode decodes a string to a log level.\nfunc (ll *LogLevel) Decode(value string) error {\n\tif level, err := zerolog.ParseLevel(value); err == nil {\n\t\t*ll = LogLevel(level)\n\t\treturn nil\n\t}\n\t*ll = LogLevel(zerolog.InfoLevel)\n\treturn errors.New(\"unknown log level\")\n}\n\n// AsZeroLogLevel converts the LogLevel to a zerolog.Level.\nfunc (ll LogLevel) AsZeroLogLevel() zerolog.Level {\n\treturn zerolog.Level(ll)\n}\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/gotify/server/blob/14bfc256276775c425f988d621dccfe705de18ac/config/loglevel.go#L1-L26","documentation":"Error from LogLevel.Decode (config/loglevel.go): the configured log level string could not be parsed by zerolog.ParseLevel. Decode falls back to InfoLevel and returns this error so the operator knows the configured value was invalid. Used by parseLogLevel during config loading.","triggerScenarios":"Setting the log level config option (e.g. log-level in config.yml or env) to a value zerolog doesn't accept — anything outside trace/debug/info/warn/error/fatal/panic/disabled and their numeric equivalents.","commonSituations":"Typos like 'warning' (instead of 'warn') or 'verbose'; capitalization handled, but arbitrary words not; copy-pasted level names from a different logging library (logrus 'warning', zap 'Warn'); empty string from an unset env var.","solutions":["Set the log level to one zerolog accepts: trace, debug, info, warn, error, fatal, panic, disabled (or a numeric level)","Replace library-specific names like 'warning' or 'verbose' with 'warn' or the appropriate level","Leave the option unset to get the default (Decode falls back to info on error, but fix the value to silence the error)"],"exampleFix":"# before (config.yml)\nlog-level: warning\n# after\nlog-level: warn","handlingStrategy":"validation","validationCode":"validLevels := []string{\"trace\",\"debug\",\"info\",\"warn\",\"error\",\"fatal\",\"panic\",\"disabled\"}\nfunc isValidLogLevel(s string) bool {\n    _, err := zerolog.ParseLevel(s)\n    return err == nil\n}","typeGuard":"func isValidLogLevel(s string) bool {\n    _, err := zerolog.ParseLevel(s)\n    return err == nil\n}","tryCatchPattern":"if err := logLevel.Decode(cfg.LogLevel); err != nil {\n    log.Warn().Str(\"configured\", cfg.LogLevel).Msg(\"unknown log level; falling back to info\")\n}","preventionTips":["Use only zerolog-accepted level names: trace, debug, info, warn, error, fatal, panic, disabled","Translate levels from other libraries (logrus 'warning' -> 'warn') when porting configs","Validate the log-level config at startup and fail fast with the accepted values in the message","Don't leave empty strings from unset env vars in log-level config"],"tags":["config","logging","zerolog","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"14bfc256276775c425f988d621dccfe705de18ac","analyzedAt":"2026-09-05T12:52:36.781Z","contentChangedAt":"2026-09-05T12:52:36.781Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}