{"record":{"id":"a1ee7f05d5cd84fa","repo":"ramensoftware/windhawk","slug":"the-mod-source-could-not-be-parsed-so-its-settings-were-not","errorCode":null,"errorMessage":"the mod source could not be parsed, so its settings were not exported","messagePattern":"the mod source could not be parsed, so its settings were not exported","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/windhawk-core/core/src/services/user_data.rs","lineNumber":318,"sourceCode":"            // of the whole section - cannot be seen half-done as an empty map.\n            let raw = {\n                let mod_lock = session.mod_lock(id);\n                let _guard = mod_lock.read().unwrap_or_else(|e| e.into_inner());\n                read_mod_settings(session, id)?\n            };\n            let settings = canonicalize_settings(&items, &raw);\n            // An empty map (nothing stored, or every stored key stale and\n            // dropped) carries nothing, so omit it rather than emitting an empty\n            // `settings` object. `None` also makes `inspect` report the facet as\n            // absent, consistent with the archive.\n            if settings.as_object().is_some_and(Map::is_empty) {\n                Ok(None)\n            } else {\n                Ok(Some(settings))\n            }\n        }\n        Err(_) => {\n            warnings.push(warn(\n                id,\n                \"the mod source could not be parsed, so its settings were not exported\",\n            ));\n            Ok(None)\n        }\n    }\n}\n\n/// Resolve the scope against the installed set, returning the storage ids to\n/// export. An explicit id that is not installed is a selection error.\nfn resolve_scope(\n    scope: &ModScope,\n    list: &ListInstalledModsResult,\n) -> Result<BTreeSet<String>, CoreError> {\n    match scope {\n        ModScope::Keyword(ModScopeKeyword::All) => Ok(list.mods.keys().cloned().collect()),\n        ModScope::Keyword(ModScopeKeyword::AllExceptLocal) => Ok(list\n            .mods","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/ramensoftware/windhawk/blob/61d99ed8e182e1af1b60109612b6763ad1b4b74e/src/windhawk-core/core/src/services/user_data.rs#L300-L336","documentation":"When exporting a mod, canonical_settings parses the mod's source code to extract its settings. If the source cannot be parsed, the settings cannot be canonically serialized, so a warning is recorded and the mod is exported without settings rather than failing the entire export.","triggerScenarios":"export_mod -> canonical_settings receives mod source text that the parser rejects (syntax error, unsupported construct, or non-UTF8/garbled source).","commonSituations":"A user hand-edited the mod source and broke its syntax; a mod fetched from an incompatible Windhawk version; truncated or corrupted source stored in user data.","solutions":["Open the mod source and fix the syntax error that breaks parsing","Restore the original mod source from the upstream repository or a backup","Re-run the export; settings will be included once the source parses","If settings are not needed, ignore the warning — the mod itself is still exported"],"exampleFix":"// before: broken mod source stored in user data\n// ==WindhawkMod==\n// @id example-mod\n==/WindhawkMod==  (unterminated block)\n// after: restore the complete metadata block\n// ==WindhawkMod==\n// @id example-mod\n// ==/WindhawkMod==","handlingStrategy":"fallback","validationCode":"// parse source before storing/exporting\nmatch parse_mod_source(&src) {\n    Ok(_) => proceed(),\n    Err(e) => repair_source_or_warn(&e),\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Parse and validate mod source when it is saved, not at export time","Keep backups of original mod sources","Avoid hand-editing mod metadata blocks"],"tags":["export","parsing","rust"],"backgroundTag":"json-parse-error","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"}