gotify/server · warning
unknown log level
Error message
unknown log level
What it means
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.
Source
Thrown at config/loglevel.go:19
package config
import (
"errors"
"github.com/rs/zerolog"
)
// LogLevel type that provides helper methods for decoding.
type LogLevel zerolog.Level
// Decode decodes a string to a log level.
func (ll *LogLevel) Decode(value string) error {
if level, err := zerolog.ParseLevel(value); err == nil {
*ll = LogLevel(level)
return nil
}
*ll = LogLevel(zerolog.InfoLevel)
return errors.New("unknown log level")
}
// AsZeroLogLevel converts the LogLevel to a zerolog.Level.
func (ll LogLevel) AsZeroLogLevel() zerolog.Level {
return zerolog.Level(ll)
}
View on GitHub (pinned to 14bfc25627)
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)
Example fix
# before (config.yml) log-level: warning # after log-level: warn
Defensive patterns
Strategy: validation
Validate before calling
validLevels := []string{"trace","debug","info","warn","error","fatal","panic","disabled"}
func isValidLogLevel(s string) bool {
_, err := zerolog.ParseLevel(s)
return err == nil
} Type guard
func isValidLogLevel(s string) bool {
_, err := zerolog.ParseLevel(s)
return err == nil
} Try / catch
if err := logLevel.Decode(cfg.LogLevel); err != nil {
log.Warn().Str("configured", cfg.LogLevel).Msg("unknown log level; falling back to info")
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- file must be an image
- invalid file extension
- appid is required when not authenticating with an applicatio
- appid not found
- username claim was empty
AI-assisted analysis of gotify/server@14bfc25627 (2026-09-05).
Data as JSON: /api/errors/4fd67f01df03a973.
Report an issue: GitHub.