{"record":{"id":"ae691956d0aa0c8b","repo":"ramensoftware/windhawk","slug":"the-mod-could-not-be-loaded-so-it-was-not-exported","errorCode":null,"errorMessage":"the mod could not be loaded, so it was not exported ({})","messagePattern":"the mod could not be loaded, so it was not exported \\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/windhawk-core/core/src/services/user_data.rs","lineNumber":152,"sourceCode":"    // invisible to the loop above; surface it as a warning when a keyword scope\n    // would have included it, so a backup is never silently missing a mod. A\n    // load-errored mod that still has a listing entry (a config-derived entry\n    // whose source failed to parse) flows through `export_mod`, which warns on\n    // its own terms; an explicit id naming a load-errored mod is a selection\n    // error (`resolve_scope`).\n    for load_error in &list.load_errors {\n        if list.mods.contains_key(&load_error.mod_id) {\n            continue;\n        }\n        let in_scope = match &selection.mods {\n            ModScope::Keyword(ModScopeKeyword::All) => true,\n            ModScope::Keyword(ModScopeKeyword::AllExceptLocal) => {\n                !ModId::str_is_local(&load_error.mod_id)\n            }\n            ModScope::Keyword(ModScopeKeyword::None) | ModScope::Ids { .. } => false,\n        };\n        if in_scope {\n            warnings.push(warn(\n                &load_error.mod_id,\n                format!(\n                    \"the mod could not be loaded, so it was not exported ({})\",\n                    load_error.error\n                ),\n            ));\n        }\n    }\n\n    let archive = UserDataArchive {\n        format: FORMAT_TAG.to_owned(),\n        app_settings: app_settings_out,\n        mods,\n    };\n\n    to_value_result(\n        \"exportUserData\",\n        &ExportUserDataResult {","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/ramensoftware/windhawk/blob/61d99ed8e182e1af1b60109612b6763ad1b4b74e/src/windhawk-core/core/src/services/user_data.rs#L134-L170","documentation":"This is not a hard failure but a warning emitted during mod-settings export: a mod present in the current scope failed to load, so it cannot be exported and is skipped with a warning naming the underlying load error. The export continues for all other mods; the warning is scoped via ModScope, so locally-installed mods may be excluded from reporting depending on the scope (e.g. AllExceptLocal filters them out).","triggerScenarios":"Calling the public export function while a mod referenced by the selected ModScope has a load error recorded (e.g. the mod file is missing, corrupt, or failed to initialize), and the scope check (scope_matches) returns true for that mod's id.","commonSituations":"Exporting settings on a machine where a mod was uninstalled or renamed but is still referenced; a mod failed to compile/load after a Windhawk or engine update; a partially-copied mods directory; exporting with ModScope::All for a corrupted third-party mod.","solutions":["Read the embedded load_error.error in the warning to identify why the mod failed to load, then fix that root cause (reinstall or repair the mod).","Remove or repair the broken mod so the export no longer references it.","Narrow the export scope (e.g. ModScope::Ids with only healthy mods, or AllExceptLocal) to skip unloadable mods intentionally.","Re-run the export after fixing; treat the warnings list as the record of what was skipped."],"exampleFix":"// before: export blindly, mod fails to load\nlet result = export(ModScope::Keyword(ModScopeKeyword::All));\n\n// after: ensure mods load before export, or scope to healthy ids\nlet healthy: Vec<ModId> = mods.iter().filter(|m| m.load_error.is_none()).map(|m| m.id.clone()).collect();\nlet result = export(ModScope::Ids { ids: healthy });","handlingStrategy":"try-catch","validationCode":"let broken: Vec<&ModId> = load_errors.iter().filter(|e| in_scope(e)).map(|e| &e.mod_id).collect();\nif !broken.is_empty() { /* repair or rescope before export */ }","typeGuard":null,"tryCatchPattern":"match export(scope) {\n    Ok(r) if r.warnings.is_empty() => r,\n    Ok(r) => { for w in &r.warnings { log::warn!(\"skipped: {w}\"); } r },\n    Err(e) => { log::error!(\"export failed: {e}\"); fallback_export()? }\n}","preventionTips":["Validate mod loadability before export and repair or rescope unloadable mods.","Keep the mods directory consistent (no dangling references after uninstall).","Treat export warnings as actionable: review them on every export.","Prefer explicit ModScope::Ids for automated pipelines so failures are deterministic."],"tags":["export","mod-loading","warning","configuration"],"backgroundTag":"module-init-failed","analyzedSha":"61d99ed8e182e1af1b60109612b6763ad1b4b74e","analyzedAt":"2026-09-12T14:02:41.115Z","contentChangedAt":"2026-09-12T14:02:41.115Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}