{"record":{"id":"5975ca68d9246f3b","repo":"ramensoftware/windhawk","slug":"the-mod-s-source-cause-so-it-was-not-exported","errorCode":null,"errorMessage":"the mod's source {cause}, so it was not exported","messagePattern":"the mod's source (.+?), so it was not exported","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/windhawk-core/core/src/services/user_data.rs","lineNumber":214,"sourceCode":"        ));\n        return Ok(None);\n    }\n    let name = entry.metadata.as_ref().and_then(|m| m.name.clone());\n\n    let (want_settings, want_config) = facet_toggles(selection, id);\n    // A repository mod's source embeds only under an offline export; a local\n    // mod's source is always embedded (it exists nowhere else). The source is\n    // read locally whenever settings are selected, to canonicalize against its\n    // declared types, even when it is not embedded.\n    let embed = is_local || offline;\n    let need_source = embed || want_settings;\n    let mut source_text = None;\n    if need_source {\n        match read_source(session, id)? {\n            SourceRead::Text(text) => source_text = Some(text),\n            SourceRead::Unusable(cause) => {\n                if is_local {\n                    warnings.push(warn(\n                        id,\n                        format!(\"the mod's source {cause}, so it was not exported\"),\n                    ));\n                    return Ok(None);\n                }\n                // A repository mod with no usable source (a broken install):\n                // export it reference-only, without settings.\n                let mut message =\n                    format!(\"the mod source {cause}, so its settings were not exported\");\n                if offline {\n                    message.push_str(\n                        \"; this offline archive references the mod instead of embedding it\",\n                    );\n                }\n                warnings.push(warn(id, message));\n            }\n        }\n    }","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/ramensoftware/windhawk/blob/61d99ed8e182e1af1b60109612b6763ad1b4b74e/src/windhawk-core/core/src/services/user_data.rs#L196-L232","documentation":"When exporting a LOCAL mod whose source file cannot be read (SourceRead::Unusable), the mod cannot be embedded anywhere, so export_mod skips it entirely and emits this warning: 'the mod's source <cause>, so it was not exported'. The cause explains how the read failed.","triggerScenarios":"Running `data export` with a local (@-prefixed) mod selected whose source file is missing, unreadable, or fails validation — the mod is dropped from the archive.","commonSituations":"Users deleting or renaming a local mod's .whcpp/compilation file after install; permission problems on the mods storage directory; migrating machines without copying mod source files.","solutions":["Restore or fix the local mod's source file on disk, then re-export","Recreate the local mod (paste its source) so the file exists again","Exclude the broken local mod from the export selection","Check file permissions on the Windhawk mods directory"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// before export: verify local mod source files exist and are readable\nfor id in local_mod_ids_in_selection() {\n    let p = local_mod_source_path(id);\n    if !p.exists() || std::fs::read(&p).is_err() { eprintln!(\"{id}: source unreadable\"); }\n}","typeGuard":"fn source_readable(p: &Path) -> bool {\n    p.is_file() && std::fs::File::open(p).is_ok()\n}","tryCatchPattern":null,"preventionTips":["Never delete the mods storage directory manually","Copy mod source files when migrating machines","Recreate local mods whose source was lost before exporting"],"tags":["export","user-data","local-mods","file-read"],"backgroundTag":"file-read-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"}