{"record":{"id":"1ad030b5fe82c52a","repo":"cross-rs/cross","slug":"invalid-platform-specified","errorCode":null,"errorMessage":"invalid platform specified","messagePattern":"invalid platform specified","errorType":"validation","errorClass":"eyre::ErrReport","httpStatus":null,"severity":"error","filePath":"src/docker/image.rs","lineNumber":256,"sourceCode":"            \"linux/amd64\" => return Ok(Self::X86_64_UNKNOWN_LINUX_GNU),\n            \"linux/arm64\" | \"linux/arm64/v8\" => return Ok(Self::AARCH64_UNKNOWN_LINUX_GNU),\n            _ => {}\n        };\n\n        if let Some((platform, toolchain)) = s.split_once('=') {\n            let image_toolchain = toolchain.into();\n            let (os, arch, variant) = if let Some((os, rest)) = platform.split_once('/') {\n                let os: StrDeserializer<'_, SerdeError> = os.into_deserializer();\n                let (arch, variant) = if let Some((arch, variant)) = rest.split_once('/') {\n                    let arch: StrDeserializer<'_, SerdeError> = arch.into_deserializer();\n                    (arch, Some(variant))\n                } else {\n                    let arch: StrDeserializer<'_, SerdeError> = rest.into_deserializer();\n                    (arch, None)\n                };\n                (os, arch, variant)\n            } else {\n                eyre::bail!(\"invalid platform specified\")\n            };\n            Ok(ImagePlatform {\n                architecture: Architecture::deserialize(arch)?,\n                os: Os::deserialize(os)?,\n                variant: variant.map(ToOwned::to_owned),\n                target: image_toolchain,\n            })\n        } else {\n            Ok(ImagePlatform::from_target(s.into())\n                .wrap_err_with(|| format!(\"could not map `{s}` to a platform\"))?)\n        }\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)]\n#[serde(rename_all = \"lowercase\")]\npub enum Architecture {\n    I386,","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/docker/image.rs#L238-L274","documentation":"`ImagePlatform::from_str` parses a platform triple (os/arch[/variant]) and fails when the string does not split into the expected components, i.e. it lacks the required os/arch segments separated appropriately.","triggerScenarios":"Passing a malformed platform string such as \"linux\", \"x86_64\" (missing os), an empty string, or a string with too few `/`-separated parts to `ImagePlatform::from_str` or the platform CLI flag.","commonSituations":"Hand-typing a `--platform` flag value, copying a target triple like `x86_64-unknown-linux-gnu` where a platform string `linux/amd64` is expected, or CI variables set incorrectly.","solutions":["Use the full os/arch form: e.g. `linux/amd64`, `linux/arm64`, `windows/amd64`.","Check whether you meant a Rust target triple and convert it (e.g. via from_target/new) instead of from_str.","Count the separators — the value needs both os and arch components."],"exampleFix":"// before\nImagePlatform::from_str(\"amd64\")? // fails: missing os\n// after\nImagePlatform::from_str(\"linux/amd64\")?","handlingStrategy":"validation","validationCode":"fn is_platform_str(s: &str) -> bool {\n    let parts: Vec<&str> = s.split('/').collect();\n    parts.len() >= 2 && parts.iter().all(|p| !p.is_empty())\n}","typeGuard":"fn parse_platform(s: &str) -> Option<(String, String)> {\n    let mut it = s.split('/');\n    Some((it.next()?.to_string(), it.next()?.to_string()))\n}","tryCatchPattern":null,"preventionTips":["Use os/arch form (linux/amd64), not Rust target triples, wherever platform strings are expected.","Validate --platform flag values against a known list before invoking the API.","Normalize user input with to_lowercase() and trim whitespace first."],"tags":["docker","platform","parsing","format"],"backgroundTag":"invalid-argument-format","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"}