{"record":{"id":"b1511142a5019ebd","repo":"cross-rs/cross","slug":"a-target-named-mentioned-target-is-mentioned-in-the-cross","errorCode":null,"errorMessage":"a target named \"{mentioned_target}\" is mentioned in the Cross configuration, but the current specified target is \"{target}\".","messagePattern":"a target named \"(.+?)\" is mentioned in the Cross configuration, but the current specified target is \"(.+?)\"\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/config.rs","lineNumber":262,"sourceCode":"\nimpl Config {\n    pub fn new(toml: Option<CrossToml>) -> Self {\n        Config {\n            toml,\n            env: Environment::new(None),\n        }\n    }\n\n    pub fn confusable_target(&self, target: &Target, msg_info: &mut MessageInfo) -> Result<()> {\n        if let Some(keys) = self.toml.as_ref().map(|t| t.targets.keys()) {\n            for mentioned_target in keys {\n                let mentioned_target_norm = mentioned_target\n                    .to_string()\n                    .replace(['-', '_'], \"\")\n                    .to_lowercase();\n                let target_norm = target.to_string().replace(['-', '_'], \"\").to_lowercase();\n                if mentioned_target != target && mentioned_target_norm == target_norm {\n                    msg_info.warn(format_args!(\"a target named \\\"{mentioned_target}\\\" is mentioned in the Cross configuration, but the current specified target is \\\"{target}\\\".\"))?;\n                    msg_info.status(\" > Is the target misspelled in the Cross configuration?\")?;\n                }\n            }\n        }\n        Ok(())\n    }\n\n    fn get_from_value_inner<T, U>(\n        &self,\n        target: &Target,\n        env: impl for<'a> FnOnce(&'a Environment, &Target) -> ConfVal<T>,\n        config: impl for<'a> FnOnce(&'a CrossToml, &Target) -> ConfVal<Cow<'a, U>>,\n    ) -> Option<T>\n    where\n        U: ToOwned<Owned = T> + ?Sized,\n    {\n        let env = env(&self.env, target);\n        let toml = self","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/config.rs#L244-L280","documentation":"`confusable_target` (src/config.rs:262) warns when a target mentioned in the Cross configuration (e.g. a `[target.<triple>]` section) normalizes to the same string as the current target after stripping `-`/`_` and lowercasing, but is not byte-identical. Cross proceeds but warns that the target may be misspelled, since config keys like `aarch64-linux-android` vs `aarch64_linux_android` style mismatches can silently not apply.","triggerScenarios":"A `[target.X]` table or `target.X` key in Cross.toml/config where X differs from the build target only by hyphen vs underscore or letter case (e.g. configured `x86_64_unknown_linux_gnu` while building `x86_64-unknown-linux-gnu`).","commonSituations":"Copy-pasting target triples with underscores from older docs or other tools, hand-typing triples with wrong casing, or mixing target-JSON custom target names with std triples.","solutions":["Make the target name in Cross.toml exactly match the specified target triple, using hyphens (`[target.aarch64-unknown-linux-gnu]`)","Re-run cross after fixing; the warning disappears when mentioned_target == target","If intentional (e.g. custom target with underscores), rename the config key or ignore the warning — it does not abort the build"],"exampleFix":"// before (Cross.toml)\n[target.x86_64_unknown_linux_gnu]\nimage = \"my-image\"\n// after\n[target.x86_64-unknown-linux-gnu]\nimage = \"my-image\"","handlingStrategy":"validation","validationCode":"// normalize config target keys the same way cross does before writing Cross.toml\nfn norm(s: &str) -> String { s.replace(['-','_'], \"\").to_lowercase() }\nassert_eq!(norm(\"x86_64_unknown_linux_gnu\"), norm(\"x86_64-unknown-linux-gnu\"));\n// then fix the key to the exact triple: [target.x86_64-unknown-linux-gnu]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the exact rustc target triple (hyphens, lowercase) in Cross.toml target sections","Copy target names from `rustc --print target-list` rather than typing them","Diff config target keys against the --target argument in CI to catch hyphen/underscore drift"],"tags":["config","target-triple","typo"],"backgroundTag":"invalid-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"}