SubtitleEdit/subtitleedit · warning · Exception

NameList: Unable to read name list file: {fileNameOrUrl}

Error message

NameList: Unable to read name list file: {fileNameOrUrl}

What it means

NameList's loader wraps the entire name-list-file parse (XML fetch, HTTP/HTTPS download, or local file read) in a try/catch and rethrows as a generic Exception with the file name or URL. It signals that the names resource could not be obtained or parsed for a given language, breaking spell-check/name-detection features that depend on it.

Source

Thrown at src/libse/Dictionaries/NameList.cs:181

                                    {
                                        if (reader.Name == "name")
                                        {
                                            var name = reader.ReadElementContentAsString().Trim();
                                            if (name.Length > 0)
                                            {
                                                _blackList.Add(name);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("NameList: Unable to read name list file: " + fileNameOrUrl, ex);
            }
        }

        public bool Remove(string name)
        {
            name = name.Trim();
            if (name.Length > 1 && _namesList.Contains(name) || _namesMultiList.Contains(name))
            {
                // Try removing name from both lists
                _namesList.Remove(name);
                _namesMultiList.Remove(name);
                _namesMultiListParts = null;

                var fileName = GetLocalNamesUserFileName();
                var nameListXml = CreateDocument(fileName);

                // Add removed name to blacklist
                var nameNode = nameListXml.CreateElement("name");

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Ship a local fallback names file and only fetch remote updates opportunistically.
  2. Catch the exception and degrade gracefully (disable name-based features instead of crashing spell-check).
  3. Verify the URL/file path is reachable (HEAD request / File.Exists) before parsing.
  4. Wrap the XML reader in a schema-tolerant parse and skip malformed entries.

Example fix

// before
catch (Exception ex) { throw new Exception("NameList: Unable to read name list file: " + fileNameOrUrl, ex); }

// after
catch (Exception ex)
{
    Logger.Warn(ex, $"NameList: failed to load {fileNameOrUrl}; falling back to built-in names.");
    LoadBuiltinFallback();
}
Defensive patterns

Strategy: fallback

Validate before calling

if (string.IsNullOrEmpty(fileNameOrUrl)) throw new ArgumentException("name list path required");
if (Uri.IsWellFormedUriString(fileNameOrUrl, UriKind.Absolute)) { /* HEAD-check reachable */ }
else if (!File.Exists(fileNameOrUrl)) { /* use built-in fallback */ }

Try / catch

try { names = new NameList(fileNameOrUrl); }
catch (Exception ex) when (ex.Message.Contains("name list file")) { names = NameList.BuiltIn; }

Prevention

When it happens

Trigger: Network failure fetching a remote names XML; HTTP 404/403 for the names URL; malformed XML (unexpected root, missing elements); local file missing or unreadable; encoding mismatch causing the reader to throw.

Common situations: Offline machine trying to fetch remote name lists; outdated URL after a server reorganization; proxy/firewall blocking the request; corrupt local names.xml; locale for which no names file exists.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/8a722068c1394b75. Report an issue: GitHub.