{"record":{"id":"356bc9c013296808","repo":"Unity-Technologies/UnityCsReference","slug":"id-intid-overriden-in-configuration-line-lin","errorCode":null,"errorMessage":"Id ({intId}) overriden in configuration line '{line}' is not defined by any previous lines.","messagePattern":"Id \\((.+?)\\) overriden in configuration line '(.+?)' is not defined by any previous lines\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Scripting/RestrictedApisValidation/RestrictedApisConfig.cs","lineNumber":185,"sourceCode":"        {\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\n        int referenceHashCode;\n        var isTypeSignature = false;\n        if (signature.Length == 0)\n        {\n            if (!_idToSignatureDetails.TryGetValue(intId, out var previousMappedId))\n                throw new Exception($\"Id ({intId}) overriden in configuration line '{line}' is not defined by any previous lines.\");\n\n            (referenceHashCode, isTypeSignature)  = previousMappedId;\n        }\n        else\n        {\n            isTypeSignature = line.AsSpan().IndexOf(\"::\") == -1; // member signatures must have a :: as a declaring type name/member name separator\n\n            //TODO: When we switch from netstandard to *any* .NET BCL, remove the ToString() and call String.GetHashCode(signature) : https://learn.microsoft.com/en-us/dotnet/api/system.string.gethashcode?view=net-9.0#system-string-gethashcode(system-readonlyspan((system-char)))\n            referenceHashCode = signature.ToString().GetHashCode();\n            _idToSignatureDetails[intId] = new (referenceHashCode, isTypeSignature);\n        }\n\n        var targetContainer = isTypeSignature ?  currentTypesConfig :  currentMembersConfig;\n        if (!Enum.TryParse<RestrictedApiSeverity>(severitySpan.ToString(), ignoreCase: true, out var severity))\n        {\n            throw new Exception($\"Invalid severity '{severitySpan.ToString()}' in line '{line}'\");\n        }\n","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Scripting/RestrictedApisValidation/RestrictedApisConfig.cs#L167-L203","documentation":"Thrown when a rule is an override (empty signature field, ':id | | severity') but the id was never introduced by a prior line. Overrides reuse a previously defined id's signature; an unknown id cannot be overridden.","triggerScenarios":"A line ':id | | severity' where 'id' was not defined earlier in the file by a full ':id | signature | severity' rule.","commonSituations":"Ordering override lines before their definition, deleting a definition while keeping its override, or mismatched ids.","solutions":["Ensure the id was first defined with a signature in an earlier line before overriding it.","Reorder the file so definitions precede overrides, or add the missing definition."],"exampleFix":"// before\n:1001 | | warning\n// after\n:1001 | System.IO.File::Open | error\n:1001 | | warning","handlingStrategy":"validation","validationCode":"// Overrides (empty signature) may only reference ids already defined.\nHashSet<int> defined = new();\nforeach (var l in lines)\n{\n    var parts = l.Split('|');\n    if (parts.Length == 0 || !parts[0].TrimStart().StartsWith(\":\")) continue;\n    if (!Int32.TryParse(parts[0].TrimStart()[1..], out var id)) continue;\n    var sig = parts.Length > 1 ? parts[1].Trim() : \"\";\n    if (sig.Length == 0 && !defined.Contains(id))\n        throw new FormatException($\"Override references undefined id {id}: '{l}'\");\n    if (sig.Length != 0) defined.Add(id);\n}","typeGuard":null,"tryCatchPattern":"try { config = RestrictedApisConfig.Load(path); }\ncatch (Exception ex) when (ex.Message.Contains(\"is not defined by any previous lines\"))\n{ /* move/restore the definition before the override */ }","preventionTips":["Keep full ':id | signature | severity' definitions before any ':id | | severity' overrides.","When deleting a definition, delete its overrides too."],"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"}