{"record":{"id":"feeb7f12e4a17b1f","repo":"Unity-Technologies/UnityCsReference","slug":"invalid-severity-in-line-line","errorCode":null,"errorMessage":"Invalid severity '' in line '{line}'","messagePattern":"Invalid severity '' in line '(.+?)'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Scripting/RestrictedApisValidation/RestrictedApisConfig.cs","lineNumber":161,"sourceCode":"            }\n\n            currentMembersConfig = assemblySpecificConfigs._restrictedMembersConfig;\n            currentTypesConfig = assemblySpecificConfigs._restrictedTypesConfig;\n            return;\n        }\n\n        if (token[0] != ':')\n        {\n            // Invalid line\n            throw new Exception($\"Invalid configuration line: '{line}'\");\n        }\n\n        flags.Set(PerAssemblyConfigFlag, false); // Reset per-assembly configuration flag\n\n        var id = token.Slice(1);\n        var signature = NextToken(ref lineSpan, out separatorIndex);\n        if (separatorIndex == -1)\n            throw new Exception($\"Invalid severity '' in line '{line}'\");\n\n        var severitySpan = NextToken(ref lineSpan, out separatorIndex);\n        var description = \"\";\n        var documentationUrl = \"\";\n        if (separatorIndex != -1)\n        {\n            description = NextToken(ref lineSpan,  out separatorIndex).ToString();\n            if (separatorIndex != -1)\n            {\n                documentationUrl = NextToken(ref lineSpan,  out separatorIndex).ToString();\n            }\n        }\n\n        if (!Int32.TryParse(id, out var intId))\n        {\n            throw new Exception($\"Id must be a number (line: '{line}')\");\n        }\n","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Scripting/RestrictedApisValidation/RestrictedApisConfig.cs#L143-L179","documentation":"Thrown when a rule line has ':id | signature' but no third field. After consuming id and signature, NextToken returns separatorIndex -1, meaning the severity field is missing, so the parser reports an empty severity.","triggerScenarios":"A line like ':id | signature' with no severity token after the second '|'.","commonSituations":"Truncating a rule line, or forgetting the severity field when writing a rule.","solutions":["Add the severity field: ':id | signature | error' (or warning/info).","Double-check the line has at least three '|'-delimited fields: id, signature, severity."],"exampleFix":"// before\n:1001 | System.IO.File::Open\n// after\n:1001 | System.IO.File::Open | error","handlingStrategy":"validation","validationCode":"// A rule line needs at least three '|'-delimited fields: :id | signature | severity.\nvar parts = line.Split('|');\nif (parts.Length < 3 && line.AsSpan().Trim().StartsWith(\":\"))\n    throw new FormatException($\"Rule missing severity field: '{line}'\");","typeGuard":null,"tryCatchPattern":"try { config = RestrictedApisConfig.Load(path); }\ncatch (Exception ex) when (ex.Message.Contains(\"Invalid severity ''\"))\n{ /* add the severity field after the signature */ }","preventionTips":["Remember the minimum rule shape: ':id | signature | severity'.","Treat an empty severity as a missing field during authoring."],"tags":["config","restricted-apis","validation","parsing"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}