{"record":{"id":"2d36cab60a1cfdab","repo":"SubtitleEdit/subtitleedit","slug":"failed-to-parse-multiple-replace-xml-at-path-e","errorCode":null,"errorMessage":"Failed to parse multiple-replace XML at {path}: {ex.Message}","messagePattern":"Failed to parse multiple-replace XML at (.+?): (.+?)","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/MultipleReplaceLoader.cs","lineNumber":97,"sourceCode":"        {\n            return LoadCategoryItemRules(ParseJson(content, path));\n        }\n\n        return LoadCategoryItemRules(CsvRules.Parse(content));\n    }\n\n    private static List<Rule> LoadXmlRules(string content, string path)\n    {\n        GroupsRoot? root;\n        try\n        {\n            using var reader = new StringReader(content);\n            var serializer = new XmlSerializer(typeof(GroupsRoot));\n            root = (GroupsRoot?)serializer.Deserialize(reader);\n        }\n        catch (Exception ex)\n        {\n            throw new InvalidDataException($\"Failed to parse multiple-replace XML at {path}: {ex.Message}\", ex);\n        }\n\n        var rules = new List<Rule>();\n        if (root is null)\n        {\n            return rules;\n        }\n\n        foreach (var group in root.Groups.Where(g => g.IsActive))\n        {\n            foreach (var rule in group.Rules.Where(r => r.Active))\n            {\n                if (!string.IsNullOrEmpty(rule.FindWhat))\n                {\n                    rules.Add(rule);\n                }\n            }\n        }","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/MultipleReplaceLoader.cs#L79-L115","documentation":"Wrapped exception thrown by MultipleReplaceLoader.LoadXmlRules when XmlSerializer.Deserialize fails on the multiple-replace file content. The file was read successfully but is not valid XML or does not conform to the expected GroupsRoot schema (the legacy SE4 MultipleSearchAndReplaceGroups shape). The original exception is preserved as InnerException of an InvalidDataException with the path and original message.","triggerScenarios":"The multiple-replace file is selected as XML (by .xml extension or content starting with '<') but is malformed XML, has unclosed tags, invalid encoding declarations, or does not match the GroupsRoot/Group/Rule schema the deserializer expects.","commonSituations":"Editing the XML by hand and introducing a syntax error; using an XML file exported by a different tool with a different schema; encoding issues (e.g. BOM or declared encoding mismatch); a truncated file.","solutions":["Open the file in an XML validator or the Subtitle Edit GUI to see the exact parse error location.","If the file is actually JSON or CSV, rename it with the correct extension (.json/.csv) so the loader picks the right parser.","Re-export the groups from the SE GUI (Tools > Multiple replace > export) to get a schema-valid file."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var rules = MultipleReplaceLoader.LoadRules(path); }\ncatch (InvalidDataException ex) when (ex.Message.Contains(\"Failed to parse multiple-replace XML\"))\n{\n    // ex.InnerException has the XmlException with line/position\n    var xmlError = ex.InnerException;\n    // Report XML parse error, suggest re-export or fix\n}","preventionTips":["Validate XML files with an XML validator or the SE GUI before using them.","Use the correct file extension so the loader picks the right parser.","Re-export from the SE GUI to get schema-valid files rather than hand-editing XML."],"tags":["multiple-replace","xml","parse-failure","validation","subtitles"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}