ramensoftware/windhawk · error · std::runtime_error

Missing LibraryFileName value

Error message

Missing LibraryFileName value

What it means

GetModLibraryPath builds the absolute path of a mod's DLL from the LibraryFileName declared in mod metadata. If that value is absent or empty, it throws runtime_error because a mod without a library file name cannot be loaded. This is a validation guard before any path is constructed.

Solutions

  1. Add a LibraryFileName entry to the mod's metadata file matching the compiled DLL name (e.g. LibraryFileName=my_mod.dll).
  2. Re-download or reinstall the mod from a trusted source — the installed package is incomplete.
  3. If you author mods, validate your package metadata before distribution (all required keys present).

Example fix

// before ([Mod] section)
Name=MyMod
Author=Me
// after ([Mod] section)
Name=MyMod
Author=Me
LibraryFileName=MyMod.dll
Defensive patterns

Strategy: validation

Validate before calling

// C++ caller-side pre-check before Mod::Load
std::wstring libFile = ReadModSetting(modDir, L"LibraryFileName").value_or(L"");
if (libFile.empty()) {
    LOG(L"Mod %s is missing LibraryFileName; skipping", modName.c_str());
    return false;
}

Try / catch

try {
    mod->Load();
} catch (const std::runtime_error& e) {
    if (std::string_view(e.what()) == "Missing LibraryFileName value") {
        LOG(L"Skipping mod with incomplete metadata");
    }
}

Prevention

When it happens

Trigger: Mod::Load (or DoesModExportToolModMarker) reading a mod whose metadata section has no LibraryFileName key, or where it resolves to an empty string.

Common situations: Hand-edited or corrupted mod.ini/metadata files; mods downloaded with missing or stripped metadata; tooling that generates mod packages without the required key.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of ramensoftware/windhawk@61d99ed8e1 (2026-09-12). Data as JSON: /api/errors/fe08a7b030aea2bb. Report an issue: GitHub.

Appendix: source

Thrown at src/windhawk/engine/mod.cpp:256

            }
        }

        return false;
    };

    return (!patterns.includeExcludeCustomOnly &&
            listTakesEveryProcess(patterns.include)) ||
           listTakesEveryProcess(patterns.includeCustom);
}

// The library named by the mod's settings. It must be a file in the mods
// folder, so only a bare file name is accepted: a separator, a root name or a
// ".." would make the joined path escape the folder. A ':' is rejected on its
// own, since a root name is a single drive letter and "foo:bar", a stream on
// the folder, is its own filename().
std::filesystem::path GetModLibraryPath(std::wstring_view libraryFileName) {
    if (libraryFileName.empty()) {
        throw std::runtime_error("Missing LibraryFileName value");
    }

    std::filesystem::path fileName(libraryFileName);
    if (fileName != fileName.filename() ||
        libraryFileName.find(L':') != libraryFileName.npos ||
        libraryFileName == L"." || libraryFileName == L"..") {
        throw std::runtime_error("Invalid LibraryFileName value");
    }

    return StorageManager::GetInstance().GetModsPath() / fileName;
}

Mod::ChangeMarker MakeChangeMarker(PortableSettings& settings) {
    return {
        .libraryFileName = settings.GetString(L"LibraryFileName").value_or(L""),
        .settingsChangeTime =
            settings.GetInt(L"SettingsChangeTime").value_or(0),
    };

View on GitHub (pinned to 61d99ed8e1)