beeradmoore/dlss-swapper · error · Exception
Could not find dll in zip.
Error message
Could not find dll in zip.
What it means
After locating the DLL entry by name inside the downloaded zip, HandleExtractFromZip throws this if no archive entry matched the expected DLL name (DllNameForGameAssetType(assetType)). Note the code uses Single() on the entries, so this specific throw fires when the filter yields no match rather than multiple; it means the zip does not contain the DLL this record expects.
Solutions
- Verify the zip at the package URL actually contains the expected dll name for this asset type
- Confirm ZipMD5Hash/URL in the manifest matches the current upstream package
- Update DllNameForGameAssetType mapping if upstream renamed the DLL
- Log the archive's entry names in the error to aid diagnosis
Example fix
// before
var entry = zipArchive.Entries.Single(x => x.Name.Equals(dllName, StringComparison.OrdinalIgnoreCase));
// after
var entry = zipArchive.Entries.SingleOrDefault(x => x.Name.Equals(dllName, StringComparison.OrdinalIgnoreCase));
if (entry is null)
{
throw new Exception($"Could not find '{dllName}' in zip. Entries: {string.Join(", ", zipArchive.Entries.Select(e => e.FullName))}");
} Defensive patterns
Strategy: try-catch
Validate before calling
// after download, before extract
using var zip = new ZipArchive(zipStream);
var expected = DLLManager.DllNameForGameAssetType(assetType);
if (!zip.Entries.Any(e => e.Name.Equals(expected, StringComparison.OrdinalIgnoreCase)))
throw new InvalidDataException($"Package lacks {expected}."); Type guard
static ZipArchiveEntry? FindDllEntry(ZipArchive z, string dllName) =>
z.Entries.FirstOrDefault(e => e.Name.Equals(dllName, StringComparison.OrdinalIgnoreCase)); Try / catch
try
{
HandleExtractFromZip(zipArchive, dllRecord);
}
catch (Exception ex) when (ex.Message.Contains("Could not find dll in zip"))
{
logger.LogError(ex, "Package for {AssetType} is missing the expected DLL; re-download or update manifest.", dllRecord.AssetType);
} Prevention
- Validate MD5 (already enforced) and also sanity-check zip entries after download
- Keep manifest zip URLs and hashes in sync with upstream releases
- On failure, delete the cached zip so a fresh download is attempted
- Log entry names to detect upstream renames quickly
When it happens
Trigger: Downloading a zip whose contents don't include the expected file name for the asset type — wrong/mismatched zip uploaded to the CDN, renamed DLL inside the archive, case/extension differences the OrdinalIgnoreCase Single() still misses (e.g. entry in a subfolder with different name), or AssetType not matching the package.
Common situations: Upstream release repackaged the zip and renamed the dll; manifest pointing at the wrong package URL; corrupted or partial download that is still a valid zip; fetching a universal zip that stores files under directories with different entry names.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Could not download file.
- Could not deserialize manifest.json.
- Unknown AssetType
- LocalRecord was null when attempting to extract dll from…
- Downloaded file was invalid.
AI-assisted analysis of beeradmoore/dlss-swapper@ab9b1e2d4b (2026-09-15).
Data as JSON: /api/errors/913b39e7ec5b1ca5.
Report an issue: GitHub.
Appendix: source
Thrown at src/Data/DLLManager.cs:1392
/// <summary>
/// This handles extracting of the DLL from both downloaded and imported zips (when imported matches the hash of one that could be downloaded)
/// </summary>
/// <param name="zipArchive"></param>
/// <param name="dllRecord"></param>
/// <exception cref="Exception"></exception>
internal static void HandleExtractFromZip(ZipArchive zipArchive, DLLRecord dllRecord)
{
if (dllRecord.LocalRecord is null)
{
throw new Exception("LocalRecord was null when attempting to extract dll from zip.");
}
var dllName = DLLManager.DllNameForGameAssetType(dllRecord.AssetType);
var entry = zipArchive.Entries.Single(x => x.Name.Equals(dllName, StringComparison.OrdinalIgnoreCase));
if (entry is null)
{
throw new Exception("Could not find dll in zip.");
}
else
{
Storage.CreateDirectoryForFileIfNotExists(dllRecord.LocalRecord.ExpectedPath);
entry.ExtractToFile(dllRecord.LocalRecord.ExpectedPath, true);
}
}
}
View on GitHub (pinned to ab9b1e2d4b)