{"record":{"id":"a10f024f4e1ae6d6","repo":"cross-rs/cross","slug":"found-unused-key-s-in-cross-configuration","errorCode":null,"errorMessage":"found unused key(s) in Cross configuration{}:\n > {}","messagePattern":"found unused key\\(s\\) in Cross configuration(.+?):\n > (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cross_toml.rs","lineNumber":199,"sourceCode":"    }\n\n    /// Parses the [`CrossToml`] from a [`Deserializer`]\n    pub fn parse_from_deserializer<'de, D>(\n        deserializer: D,\n        source: Option<&str>,\n        msg_info: &mut MessageInfo,\n    ) -> Result<(Self, BTreeSet<String>)>\n    where\n        D: Deserializer<'de>,\n        D::Error: Send + Sync + 'static,\n    {\n        let mut unused = BTreeSet::new();\n        let cfg = serde_ignored::deserialize(deserializer, |path| {\n            unused.insert(path.to_string());\n        })?;\n\n        if !unused.is_empty() {\n            msg_info.warn(format_args!(\n                \"found unused key(s) in Cross configuration{}:\\n > {}\",\n                source.map(|s| format!(\" at {s}\")).unwrap_or_default(),\n                unused.clone().into_iter().collect::<Vec<_>>().join(\", \")\n            ))?;\n        }\n\n        Ok((cfg, unused))\n    }\n\n    /// Merges another [`CrossToml`] into `self` and returns a new merged one\n    pub fn merge(self, other: CrossToml) -> Result<CrossToml> {\n        type ValueMap = serde_json::Map<String, serde_json::Value>;\n\n        fn to_map<S: Serialize>(s: S) -> Result<ValueMap> {\n            if let Some(obj) = serde_json::to_value(s)\n                .wrap_err(\"could not convert CrossToml to serde_json::Value\")?\n                .as_object()\n            {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/cross_toml.rs#L181-L217","documentation":"cross parses the `Cross.toml` config with serde and tracks keys that serde never consumed via `serde_ignored`. When any key in the configuration is not recognized (e.g. a typo or a key from an older cross version), it emits this warning listing the unused keys and where the config came from.","triggerScenarios":"Deserializing a Cross.toml (or config from another source) in parse_from_deserializer when one or more top-level or nested keys do not match any field of the cross `Configuration` struct, such as misspelled table names like `[build.env]` instead of `[build.env.volumes]` or obsolete keys.","commonSituations":"Typos in Cross.toml keys; following outdated blog posts referencing keys removed in newer cross versions; placing keys at the wrong nesting level (serde matches exact paths); copying config snippets for a different tool.","solutions":["Open Cross.toml and compare each listed unused key against the documented cross configuration schema; fix typos or remove stale keys.","Move the key to the correct nesting level if it is a valid option placed in the wrong table.","Check the installed cross version's documentation; keys valid in older versions may have been renamed or removed.","If the key is intentionally informational (e.g. custom metadata), move it out of Cross.toml or ignore the warning."],"exampleFix":"# before (Cross.toml)\n[build.env]\npassthrough = [\"RUSTFLAGS\"]\n\n# after\n[build.env]\npassthrough = [\"RUSTFLAGS\"]\n# key must be valid; e.g. typo'd 'passthru' or unknown 'mycustomkey' removed","handlingStrategy":"validation","validationCode":"// Pre-validate Cross.toml keys against known top-level tables\nlet known = [\"build\", \"target\", \"env\", \"ci\"];\nlet cfg: toml::Value = toml::from_str(&toml_text)?;\nfor (k, _) in cfg.as_table().unwrap() {\n    if !known.contains(&k.as_str()) {\n        eprintln!(\"unknown Cross.toml key: {}\", k);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate Cross.toml against the current cross schema after every cross upgrade","Avoid copying config snippets from outdated tutorials","Keep custom metadata out of Cross.toml"],"tags":["config","serde","unused-key","toml"],"backgroundTag":"unsupported-config-value","analyzedSha":"8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27","analyzedAt":"2026-09-13T15:10:43.988Z","contentChangedAt":"2026-09-13T15:10:43.988Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}