{"record":{"id":"6fe0155c6467bb6b","repo":"SubtitleEdit/subtitleedit","slug":"senameslist-unable-to-read-name-list-file-filen","errorCode":null,"errorMessage":"SeNamesList: Unable to read name list file: {fileNameOrUrl}","messagePattern":"SeNamesList: Unable to read name list file: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/ui/Logic/Dictionaries/SeNamesList.cs","lineNumber":399,"sourceCode":"                        {\n                            continue;\n                        }\n\n                        if (reader.Name == \"name\")\n                        {\n                            var name = reader.ReadElementContentAsString().Trim();\n                            if (name.Length > 0)\n                            {\n                                _blackList.Add(name);\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        catch (Exception ex)\n        {\n            throw new Exception(\"SeNamesList: Unable to read name list file: \" + fileNameOrUrl, ex);\n        }\n    }\n}","sourceCodeStart":381,"sourceCodeEnd":402,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Dictionaries/SeNamesList.cs#L381-L402","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nusing var reader = XmlReader.Create(fileNameOrUrl);\n// ... parse ...\n\n// after - validate the source is reachable/parseable first\nif (fileNameOrUrl.StartsWith(\"http\", StringComparison.OrdinalIgnoreCase))\n{\n    using var http = new HttpClient();\n    var probe = await http.GetAsync(fileNameOrUrl);\n    probe.EnsureSuccessStatusCode();\n}\nelse if (!File.Exists(fileNameOrUrl))\n{\n    SeLogger.Warning($\"Names list not found, skipping: {fileNameOrUrl}\");\n    return;\n}\nvar settings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Ignore, CloseInput = true };\nusing var reader = XmlReader.Create(fileNameOrUrl, settings);","handlingStrategy":"try-catch","validationCode":"if (fileNameOrUrl.StartsWith(\"http\", StringComparison.OrdinalIgnoreCase))\n{\n    using var http = new HttpClient();\n    using var probe = await http.GetAsync(fileNameOrUrl, HttpCompletionOption.ResponseHeadersRead);\n    probe.EnsureSuccessStatusCode();\n}\nelse if (!File.Exists(fileNameOrUrl)) { SeLogger.Warning($\"Names list not found: {fileNameOrUrl}\"); return; }","typeGuard":null,"tryCatchPattern":"try { using var reader = XmlReader.Create(fileNameOrUrl); /* parse */ }\ncatch (Exception ex)\n{\n    // Preserve as inner, include the path/URL\n    throw new Exception($\"SeNamesList: Unable to read name list file: {fileNameOrUrl}\", ex);\n}","preventionTips":["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."],"tags":["names-list","xml","io","network","dictionaries"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}