SubtitleEdit/subtitleedit · error · InvalidDataException
Failed to parse multiple-replace XML at {path}: {ex.Message}
Error message
Failed to parse multiple-replace XML at {path}: {ex.Message} What it means
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.
Source
Thrown at src/seconv/Core/MultipleReplaceLoader.cs:97
{
return LoadCategoryItemRules(ParseJson(content, path));
}
return LoadCategoryItemRules(CsvRules.Parse(content));
}
private static List<Rule> LoadXmlRules(string content, string path)
{
GroupsRoot? root;
try
{
using var reader = new StringReader(content);
var serializer = new XmlSerializer(typeof(GroupsRoot));
root = (GroupsRoot?)serializer.Deserialize(reader);
}
catch (Exception ex)
{
throw new InvalidDataException($"Failed to parse multiple-replace XML at {path}: {ex.Message}", ex);
}
var rules = new List<Rule>();
if (root is null)
{
return rules;
}
foreach (var group in root.Groups.Where(g => g.IsActive))
{
foreach (var rule in group.Rules.Where(r => r.Active))
{
if (!string.IsNullOrEmpty(rule.FindWhat))
{
rules.Add(rule);
}
}
}View on GitHub (pinned to 17a9f07487)
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.
Defensive patterns
Strategy: try-catch
Try / catch
try { var rules = MultipleReplaceLoader.LoadRules(path); }
catch (InvalidDataException ex) when (ex.Message.Contains("Failed to parse multiple-replace XML"))
{
// ex.InnerException has the XmlException with line/position
var xmlError = ex.InnerException;
// Report XML parse error, suggest re-export or fix
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse multiple-replace JSON at {path}: {ex.Message
- Failed to read multiple-replace file at {path}: {ex.Message}
- Multiple-replace file not found: {path}
- No Blu-Ray sup subtitles found in: {filePath}
- No PGS subtitles in MKV track #{track.TrackNumber}.
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/2d36cab60a1cfdab.
Report an issue: GitHub.