{"record":{"id":"4b689c94fcd9d95a","repo":"slackhq/nebula","slug":"not-a-valid-logging-level-q","errorCode":null,"errorMessage":"not a valid logging level: %q","messagePattern":"not a valid logging level: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"logging/logger.go","lineNumber":214,"sourceCode":"// \"warn\"/\"warning\", \"error\", \"fatal\"/\"panic\") to a slog.Level. \"fatal\" and\n// \"panic\" are accepted for backwards compatibility with pre-slog configs\n// and both map to slog.LevelError.\nfunc ParseLevel(s string) (slog.Level, error) {\n\tswitch s {\n\tcase \"trace\":\n\t\treturn LevelTrace, nil\n\tcase \"debug\":\n\t\treturn slog.LevelDebug, nil\n\tcase \"info\":\n\t\treturn slog.LevelInfo, nil\n\tcase \"warn\", \"warning\":\n\t\treturn slog.LevelWarn, nil\n\tcase \"error\":\n\t\treturn slog.LevelError, nil\n\tcase \"fatal\", \"panic\":\n\t\treturn slog.LevelError, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"not a valid logging level: %q\", s)\n\t}\n}\n\n// LevelName returns a human-readable name for a slog.Level matching the\n// strings accepted by ParseLevel.\nfunc LevelName(l slog.Level) string {\n\tswitch {\n\tcase l <= LevelTrace:\n\t\treturn \"trace\"\n\tcase l <= slog.LevelDebug:\n\t\treturn \"debug\"\n\tcase l <= slog.LevelInfo:\n\t\treturn \"info\"\n\tcase l <= slog.LevelWarn:\n\t\treturn \"warn\"\n\tdefault:\n\t\treturn \"error\"\n\t}","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/logging/logger.go#L196-L232","documentation":"ParseLevel converts a string log level to slog.Level and returns this error for unrecognized strings. Accepted values include debug/info/warn/warning/error/fatal/panic (per the switch); everything else fails. Called by ApplyConfig and sshLogLevel.","triggerScenarios":"Setting a level in config or via SSH console (sshLogLevel) such as 'verbose', 'trace', 'WARN ' (whitespace), or a numeric level string that the switch does not handle.","commonSituations":"Using 'trace' or 'verbose' from other tools' conventions; trailing whitespace/quotes in YAML; case-sensitive input like 'DEBUG'.","solutions":["Use a supported level string: debug, info, warn/warning, error, fatal/panic","Trim and lowercase the level string before parsing","Remove stray quotes/whitespace in the YAML value"],"exampleFix":"// before\nlvl, err := logging.ParseLevel(\"trace\")\n// after\ns, err2 := sanitize(level)\nif err2 != nil { return err2 }\nlvl, err := logging.ParseLevel(strings.ToLower(strings.TrimSpace(s)))","handlingStrategy":"validation","validationCode":"lvl, err := logging.ParseLevel(strings.ToLower(strings.TrimSpace(cfgLevel)))\nif err != nil {\n    lvl = slog.LevelInfo // or fail fast\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only documented levels: debug, info, warn, warning, error, fatal, panic","Note there is no 'trace' or 'verbose' level in this library","Trim/lowercase level values parsed from YAML or SSH console input"],"tags":["logging","configuration","validation"],"backgroundTag":"invalid-log-level","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}