{"record":{"id":"55391c1d2d597556","repo":"Unity-Technologies/UnityCsReference","slug":"invalid-configuration-line-line","errorCode":null,"errorMessage":"Invalid configuration line: '{line}'","messagePattern":"Invalid configuration line: '(.+?)'","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Scripting/RestrictedApisValidation/RestrictedApisConfig.cs","lineNumber":129,"sourceCode":"    {\n        const byte PerAssemblyConfigFlag = 1;\n\n        var lineSpan = line.AsSpan().Trim();\n        if (lineSpan.Length == 0)\n            return;\n\n        var commentIndex = lineSpan.IndexOf('#');\n        if (commentIndex != -1)\n            lineSpan = lineSpan[..commentIndex].Trim();\n\n        if (lineSpan.Length == 0)\n            return;\n\n        var token = NextToken(ref lineSpan, out var separatorIndex);\n        if (separatorIndex == -1)\n        {\n            if (token[0] != '@')\n                throw new Exception($\"Invalid configuration line: '{line}'\");\n\n            if (flags.Get(PerAssemblyConfigFlag))\n            {\n                throw new Exception($\"Two consecutive assembly names found; last one: '{line}'\");\n            }\n\n            // Per-assembly configuration\n            flags.Set(PerAssemblyConfigFlag, true);\n            var assemblyPath = token.Slice(1).ToString();\n            if (!_perAssemblyConfig.TryGetValue(assemblyPath, out var assemblySpecificConfigs))\n            {\n                assemblySpecificConfigs = new PerAssemblyConfig();\n                _perAssemblyConfig.Add(assemblyPath, assemblySpecificConfigs);\n            }\n\n            currentMembersConfig = assemblySpecificConfigs._restrictedMembersConfig;\n            currentTypesConfig = assemblySpecificConfigs._restrictedTypesConfig;\n            return;","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Scripting/RestrictedApisValidation/RestrictedApisConfig.cs#L111-L147","documentation":"Thrown while parsing a RestrictedApis.txt configuration line. After stripping comments, the first token had no '|' separator (NextToken returned separatorIndex -1) and did not start with '@', so the line is neither an assembly directive nor a valid rule. Every standalone (separator-less) line must be an '@assembly' directive.","triggerScenarios":"A line in RestrictedApis.txt with no '|' that is not an '@assembly' directive (e.g. a bare rule missing its '|' separators, or stray text).","commonSituations":"Hand-editing ProjectSettings/RestrictedApis.txt, malformed copy-paste of a rule, or a rule written without the required 'id | signature | severity' pipe separators.","solutions":["Re-read the header comment in RestrictedApisConfig.cs: standalone lines must be '@Assembly.dll'; rules must be ':id | signature | severity [| description | doc url]'.","Fix or delete the offending line shown in the message.","Run the editor after editing to confirm the config parses."],"exampleFix":"// before\nMyRule\n// after\n@MyAssembly.dll\n:1001 | System.IO.File::Open | error | Do not use File.Open | https://docs","handlingStrategy":"validation","validationCode":"// A line with no '|' must be an '@assembly' directive.\nvar trimmed = line.AsSpan().Trim();\nif (trimmed.Length > 0 && !trimmed.Contains('|') && !trimmed.StartsWith(\"@\"))\n    throw new FormatException($\"Line is neither an @assembly directive nor a '|'-delimited rule: '{line}'\");","typeGuard":null,"tryCatchPattern":"try { config = RestrictedApisConfig.Load(path); }\ncatch (Exception ex) when (ex.Message.Contains(\"Invalid configuration line\"))\n{ /* fix the cited line, then reload */ }","preventionTips":["Author RestrictedApis.txt from the documented format comment in RestrictedApisConfig.cs.","Lint the file: every non-comment, non-empty line is either '@assembly' or ':id | signature | severity'.","Validate changes locally before committing ProjectSettings/RestrictedApis.txt."],"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"}