SubtitleEdit/subtitleedit · error · Exception
SeNamesList: Unable to read name list file: {fileNameOrUrl}
Error message
SeNamesList: Unable to read name list file: {fileNameOrUrl} What it means
Thrown by SeNamesList.LoadNamesList as a wrapper around any exception raised while opening and parsing the names-list XML file or URL via XmlReader. The original exception is preserved as InnerException and the file name or URL is included in the message. LoadNamesList first short-circuits for blank/non-existent/non-http/non-UNC inputs (returns silently), so reaching the try means the path looked valid but reading/parsing failed.
Source
Thrown at src/ui/Logic/Dictionaries/SeNamesList.cs:399
{
continue;
}
if (reader.Name == "name")
{
var name = reader.ReadElementContentAsString().Trim();
if (name.Length > 0)
{
_blackList.Add(name);
}
}
}
}
}
}
catch (Exception ex)
{
throw new Exception("SeNamesList: Unable to read name list file: " + fileNameOrUrl, ex);
}
}
}View on GitHub (pinned to 17a9f07487)
Solutions
- Inspect the InnerException for the concrete cause (XmlException, IOException, WebException).
- Validate the file is well-formed XML (load it in a browser/editor) or fetch the URL manually to check the response.
- For remote lists, verify connectivity/URL and that the endpoint still serves the XML; provide a local copy as a fallback.
- Fix permissions/encoding of the local file and reload.
Example fix
// before
using var reader = XmlReader.Create(fileNameOrUrl);
// ... parse ...
// after - validate the source is reachable/parseable first
if (fileNameOrUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
using var http = new HttpClient();
var probe = await http.GetAsync(fileNameOrUrl);
probe.EnsureSuccessStatusCode();
}
else if (!File.Exists(fileNameOrUrl))
{
SeLogger.Warning($"Names list not found, skipping: {fileNameOrUrl}");
return;
}
var settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Ignore, CloseInput = true };
using var reader = XmlReader.Create(fileNameOrUrl, settings); Defensive patterns
Strategy: try-catch
Validate before calling
if (fileNameOrUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
using var http = new HttpClient();
using var probe = await http.GetAsync(fileNameOrUrl, HttpCompletionOption.ResponseHeadersRead);
probe.EnsureSuccessStatusCode();
}
else if (!File.Exists(fileNameOrUrl)) { SeLogger.Warning($"Names list not found: {fileNameOrUrl}"); return; } Try / catch
try { using var reader = XmlReader.Create(fileNameOrUrl); /* parse */ }
catch (Exception ex)
{
// Preserve as inner, include the path/URL
throw new Exception($"SeNamesList: Unable to read name list file: {fileNameOrUrl}", ex);
} Prevention
- Validate well-formed XML and reachability before parsing.
- Keep a local fallback copy of remote names lists.
- Use XmlReaderSettings with DtdProcessing.Ignore to avoid XXE/DoS on remote XML.
When it happens
Trigger: File: the path exists check passed but the file is corrupt XML, has wrong encoding, is locked, or becomes unreadable. URL: a remote names list is unreachable, returns non-XML, or times out during XmlReader.Create/Read. UNC: a network share is inaccessible.
Common situations: Corrupt hand-edited names XML; a custom names-list URL that is down or returns HTML/404; a network share dropping mid-read; encoding/BOM issues in the XML; permission denied on the file.
Related errors
- NameList: Unable to read name list file: {fileNameOrUrl}
- Problem accessing RIFF file {FileName}
- Problem reading data in file {FileName}
- {e.Message}
- {e.Message}
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/6fe0155c6467bb6b.
Report an issue: GitHub.