SubtitleEdit/subtitleedit · error · InvalidDataException
Archive contains an empty file entry name.
Error message
Archive contains an empty file entry name.
What it means
InvalidDataException: after stripping the leading separator and the optional skip-folder prefix, the entry name is empty AND the entry is not a directory, so it cannot be mapped to a real file path.
Source
Thrown at src/ui/Logic/SevenZipExtractor/Unpacker.cs:422
}
}
entryFullName = entryFullName.Replace('/', Path.DirectorySeparatorChar);
if (Path.IsPathRooted(entryFullName))
{
throw new InvalidDataException($"Archive entry is rooted outside the extraction folder: {reader.Entry.Key}");
}
entryFullName = entryFullName.TrimStart(Path.DirectorySeparatorChar);
if (string.IsNullOrEmpty(entryFullName))
{
if (reader.Entry.IsDirectory)
{
Directory.CreateDirectory(dir);
continue;
}
throw new InvalidDataException("Archive contains an empty file entry name.");
}
var fullFileName = Path.GetFullPath(Path.Combine(targetRoot, entryFullName));
var relativePath = Path.GetRelativePath(targetRoot, fullFileName);
if (relativePath.Equals("..", StringComparison.Ordinal) ||
relativePath.StartsWith(".." + Path.DirectorySeparatorChar, StringComparison.Ordinal) ||
Path.IsPathRooted(relativePath))
{
throw new InvalidDataException($"Archive entry is outside the extraction folder: {reader.Entry.Key}");
}
if (reader.Entry.IsDirectory)
{
if (!Directory.Exists(fullFileName))
{
Directory.CreateDirectory(fullFileName);
}
View on GitHub (pinned to 17a9f07487)
Solutions
- Verify the skipFolderLevel setting matches the archive's internal folder layout.
- Reject the archive as malformed and re-export it correctly.
- If authoring archives, ensure every file entry has a non-empty name after the intended prefix.
Example fix
// before Unpacker.ExtractArchive(archivePath, dest, skipFolderLevel: "payload"); // after if (DetectTopFolder(archivePath) != configuredSkipFolder) configuredSkipFolder = DetectTopFolder(archivePath); Unpacker.ExtractArchive(archivePath, dest, skipFolderLevel: configuredSkipFolder);
Defensive patterns
Strategy: validation
Validate before calling
var detectedTop = DetectTopFolder(archive); if (detectedTop != configuredSkipFolder) configuredSkipFolder = detectedTop;
Try / catch
try { Unpacker.ExtractArchive(archive, dest, skipFolderLevel: configuredSkipFolder); }
catch (InvalidDataException ex) when (ex.Message.Contains("empty file entry name"))
{
logger.LogWarning("Malformed archive {Archive}; retrying without skip-folder", archive);
Unpacker.ExtractArchive(archive, dest, skipFolderLevel: null);
} Prevention
- Match skipFolderLevel to the archive's actual layout.
- Reject malformed archives rather than weakening validation.
- When authoring archives, ensure non-empty file entry names.
When it happens
Trigger: An entry whose name is composed only of the skip-folder prefix or only of separators (no real filename), or a malformed archive exposing a file entry with an empty key.
Common situations: A malformed archive, or a skipFolderLevel value that consumes the entire entry name (mismatched archive layout vs. configuration).
Related errors
- Archive entry is rooted outside the extraction folder: {read
- Archive entry is outside the extraction folder: {reader.Entr
- Too many bytes for CCData!
- Color '{colorName}' not found in SKColors.
- End of file reached before expected
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/27c7f02f2192587a.
Report an issue: GitHub.