{"record":{"id":"4b2cd93ad71ac920","repo":"argoproj/argo-workflows","slug":"invalid-log-level-s","errorCode":null,"errorMessage":"invalid log level: %s","messagePattern":"invalid log level: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/logging/logging.go","lineNumber":83,"sourceCode":"\tif s == \"\" {\n\t\treturn defaultLevel, nil\n\t}\n\treturn ParseLevel(s)\n}\n\n// ParseLevel parses a string into a Level enum\nfunc ParseLevel(s string) (Level, error) {\n\tswitch strings.ToLower(s) {\n\tcase \"trace\", \"debug\": // trace is a legacy removed level\n\t\treturn Debug, nil\n\tcase \"info\", \"print\": // print is a legacy removed level\n\t\treturn Info, nil\n\tcase \"warn\":\n\t\treturn Warn, nil\n\tcase \"error\", \"fatal\", \"panic\": // fatal and panic are legacy removed levels\n\t\treturn Error, nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid log level: %s\", s)\n\t}\n}\n\nvar (\n\tlock = sync.RWMutex{}\n\n\texitFunc    func(int)\n\tglobalHooks []Hook\n)\n\n// SetExitFunc sets the exit function for testing purposes\nfunc SetExitFunc(f func(int)) {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\texitFunc = f\n}\n\n// GetExitFunc returns the current exit function","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/util/logging/logging.go#L65-L101","documentation":"ParseLevel converts a string into the Level enum. Valid values are trace/debug, info/print, warn, and error/fatal/panic (the latter two kept only as legacy aliases). Any other string returns this error; legacy names are silently mapped, but truly unknown ones are rejected.","triggerScenarios":"Setting the log level env var (e.g. ARGO_LOGLEVEL) or calling ParseLevel/ContextWithLogger with values like \"verbose\", \"warning\", \"notice\", \"5\", or \"INFO \" with stray whitespace.","commonSituations":"Migrating from logrus configs where \"warning\" was legal; numeric levels from log15/zap setups; Helm values templating an unset variable into a literal like \"<nil>\".","solutions":["Use one of: debug (or trace), info (or print), warn, error (or fatal/panic).","Prefer ParseLevelOr with an empty string so the default level applies.","Trim the env value before parsing; map \"warning\" to \"warn\" in your config tooling.","Pin the level in deployment templates to a known literal instead of free-form input."],"exampleFix":"// before\nlevel, err := logging.ParseLevel(\"warning\")\n// after\nlevel, err := logging.ParseLevelOr(strings.TrimSpace(os.Getenv(\"ARGO_LOGLEVEL\")), logging.Info)","handlingStrategy":"validation","validationCode":"var validLevels = map[string]bool{\"debug\": true, \"trace\": true, \"info\": true, \"print\": true, \"warn\": true, \"error\": true, \"fatal\": true, \"panic\": true}\nfunc logLevelValid(s string) bool { return s == \"\" || validLevels[strings.ToLower(strings.TrimSpace(s))] }","typeGuard":null,"tryCatchPattern":"lvl, err := logging.ParseLevelOr(strings.TrimSpace(raw), logging.Info)\nif err != nil {\n    log.Printf(\"bad log level %q, defaulting to info\", raw)\n    lvl = logging.Info\n}","preventionTips":["Whitelist levels (debug/info/warn/error) in deployment templates and Helm values.","Map legacy aliases from other loggers (warning→warn, verbose→debug) in config tooling.","Trim env input; use ParseLevelOr with a default."],"tags":["go","logging","configuration"],"backgroundTag":"invalid-log-level","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}