{"record":{"id":"012285b6511d47ea","repo":"getzola/zola","slug":"cannot-merge-config-toml-with-theme-toml-because-t","errorCode":null,"errorMessage":"Cannot merge config.toml with theme.toml because the following values have incompatibles types:\n- {}\n - {}","messagePattern":"Cannot merge config\\.toml with theme\\.toml because the following values have incompatibles types:\n- (.+?)\n - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"components/config/src/config/mod.rs","lineNumber":444,"sourceCode":"            // These are not tables so we have nothing to merge\n            Ok(())\n        }\n        (true, true) => {\n            // Recursively merge these tables\n            let into_table = into.as_table_mut().unwrap();\n            for (key, val) in from.as_table().unwrap() {\n                if !into_table.contains_key(key) {\n                    // An entry was missing in the first table, insert it\n                    into_table.insert(key.to_string(), val.clone());\n                    continue;\n                }\n                // Two entries to compare, recurse\n                merge(into_table.get_mut(key).unwrap(), val)?;\n            }\n            Ok(())\n        }\n        _ => {\n            // Trying to merge a table with something else\n            Err(anyhow!(\n                \"Cannot merge config.toml with theme.toml because the following values have incompatibles types:\\n- {}\\n - {}\",\n                into,\n                from\n            ))\n        }\n    }\n}\n\nimpl Default for Config {\n    fn default() -> Config {\n        Config {\n            base_url: DEFAULT_BASE_URL.to_string(),\n            title: None,\n            description: None,\n            theme: None,\n            default_language: \"en\".to_string(),\n            languages: BTreeMap::new(),","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/components/config/src/config/mod.rs#L426-L462","documentation":"When a theme is used, Zola merges the theme's theme.toml values into the site's config as a fallback. This error is raised by the recursive `merge` function when it tries to merge a TOML table with a non-table value (or vice versa) at the same key, i.e. the theme.toml and config.toml define the same key with incompatible types.","triggerScenarios":"Calling `merge` / `add_theme_extra` where a key exists as a table in one file and as a scalar/array in the other — e.g. `extra` (or any config section) is a table in theme.toml but the site's config.toml overrides the same key with a string, boolean, or array.","commonSituations":"Site config defines `extra.something` as a string while theme.toml defines `extra.something` as a table (or vice versa); overriding a whole theme `extra` subtree with a scalar; type changes after a Zola/theme upgrade.","solutions":["Open both config.toml and the theme's theme.toml, find the key present in both, and make their types match (both tables or both scalars)","If you want to override an entire theme table, replace it with a table of the same shape rather than a single value","Remove the conflicting key from your config.toml if you intend to inherit the theme's value"],"exampleFix":"// before (config.toml)\n[extra]\nauthor = \"Jane\"  # theme.toml has [extra.author] as a table with name/url\n// after\n[extra.author]\nname = \"Jane\"\nurl = \"https://example.com\"","handlingStrategy":"validation","validationCode":"// Compare value types at conflicting keys before merging\nfn same_shape(a: &toml::Value, b: &toml::Value) -> bool {\n    match (a, b) {\n        (toml::Value::Table(ta), toml::Value::Table(tb)) =>\n            ta.keys().all(|k| tb.get(k).map_or(true, |v| same_shape(&ta[k], v))),\n        (toml::Value::Table(_), _) | (_, toml::Value::Table(_)) => false,\n        _ => true,\n    }\n}","typeGuard":"fn both_tables_or_neither(a: &toml::Value, b: &toml::Value) -> bool {\n    a.is_table() == b.is_table()\n}","tryCatchPattern":"match add_theme_extra(&mut config, &theme) {\n    Err(e) if e.to_string().contains(\"incompatibles types\") => {\n        eprintln!(\"Fix the key whose type differs between config.toml and theme.toml\");\n    }\n    r => r?,\n}","preventionTips":["Review theme.toml's extra section and mirror its shapes when overriding in config.toml","Never replace a theme table value with a scalar in your config","After upgrading a theme, diff its theme.toml extra keys against your overrides"],"tags":["config","toml","themes"],"backgroundTag":"merge-type-conflict","analyzedSha":"61d30828217957120309db657950224edf9707e2","analyzedAt":"2026-09-03T14:39:09.727Z","contentChangedAt":"2026-09-03T14:39:09.727Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}