{"record":{"id":"813de84092c9c371","repo":"projectdiscovery/nuclei","slug":"invalid-severity-s","errorCode":null,"errorMessage":"Invalid severity: %s","messagePattern":"Invalid severity: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/types/severity/severity.go","lineNumber":56,"sourceCode":"\tUnknown:  \"unknown\",\n}\n\nfunc GetSupportedSeverities() Severities {\n\tvar result []Severity\n\tfor index := Severity(1); index < limit; index++ {\n\t\tresult = append(result, index)\n\t}\n\treturn result\n}\n\nfunc toSeverity(valueToMap string) (Severity, error) {\n\tnormalizedValue := normalizeValue(valueToMap)\n\tfor key, currentValue := range severityMappings {\n\t\tif normalizedValue == currentValue {\n\t\t\treturn key, nil\n\t\t}\n\t}\n\treturn -1, errors.New(\"Invalid severity: \" + valueToMap)\n}\n\nfunc normalizeValue(value string) string {\n\treturn strings.TrimSpace(strings.ToLower(value))\n}\n\nfunc (severity Severity) String() string {\n\treturn severityMappings[severity]\n}\n\n// Holder holds a Severity type. Required for un/marshalling purposes\n//\n//nolint:exported,revive //prefer to be explicit about the name, and make it refactor-safe\ntype Holder struct {\n\tSeverity Severity `mapping:\"true\"`\n}\n\n// Implement a jsonschema for the severity holder","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/model/types/severity/severity.go#L38-L74","documentation":"Raised by toSeverity when unmarshalling a template's info.severity value. The input is normalized (TrimSpace + ToLower) and looked up in severityMappings; a miss returns -1 and the error 'Invalid severity: <raw input>'. Accepted values are info, low, medium, high, critical and unknown. Because SeverityHolder.UnmarshalYAML propagates it, one bad value aborts template parsing.","triggerScenarios":"A template with severity: informational, severity: severe, or a numeric/quoted variant that is not one of the six allowed words.","commonSituations":"Hand-edited templates; severity taxonomies from other tools (e.g. 'High ', 'MEDIUM' are fine after normalization, but 'med', 'critical-high' are not); automated template generation that emits arbitrary labels.","solutions":["Set severity to one of: info, low, medium, high, critical, unknown","Run nuclei -validate on the template to catch it before execution","If generating templates programmatically, restrict the enum at the generator side"],"exampleFix":"# before\ninfo:\n  severity: informational\n# after\ninfo:\n  severity: info","handlingStrategy":"validation","validationCode":"var validSeverities = map[string]bool{\"info\": true, \"low\": true, \"medium\": true, \"high\": true, \"critical\": true, \"unknown\": true}\nfunc severityOK(s string) bool { return validSeverities[strings.ToLower(strings.TrimSpace(s))] }","typeGuard":null,"tryCatchPattern":"if _, err := severity.SeverityHolder{...}; err != nil { ... } // or check strings.HasPrefix(err.Error(), \"Invalid severity:\")","preventionTips":["Constrain severity to the six-word enum at template-generation time","Run nuclei -validate in CI for every template change","Reject unknown severities in linters, not at scan time"],"tags":["template","yaml","severity","validation"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}