{"record":{"id":"2b9f5b934c36ffa8","repo":"rust-lang/cargo","slug":"unstable-gitoxide-only-takes-fetch-and-checko","errorCode":null,"errorMessage":"unstable 'gitoxide' only takes `fetch` and `checkout` as valid inputs, for shallow fetches see `-Zgit=shallow-index,shallow-deps`","messagePattern":"unstable 'gitoxide' only takes `fetch` and `checkout` as valid inputs, for shallow fetches see `-Zgit=shallow-index,shallow-deps`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/workspace/features.rs","lineNumber":1235,"sourceCode":"            Ok(Some(GitoxideFeatures::deserialize(mvd)?))\n        }\n    }\n\n    deserializer.deserialize_any(GitoxideFeaturesVisitor)\n}\n\nfn parse_gitoxide(\n    it: impl Iterator<Item = impl AsRef<str>>,\n) -> CargoResult<Option<GitoxideFeatures>> {\n    let mut out = GitoxideFeatures::default();\n    let GitoxideFeatures { fetch, checkout } = &mut out;\n\n    for e in it {\n        match e.as_ref() {\n            \"fetch\" => *fetch = true,\n            \"checkout\" => *checkout = true,\n            _ => {\n                bail!(GitoxideFeatures::expecting())\n            }\n        }\n    }\n    Ok(Some(out))\n}\n\nimpl CliUnstable {\n    /// Parses `-Z` flags from the command line, and returns messages that warn\n    /// if any flag has already been stabilized.\n    pub fn parse(\n        &mut self,\n        flags: &[String],\n        nightly_features_allowed: bool,\n    ) -> CargoResult<Vec<String>> {\n        if !flags.is_empty() && !nightly_features_allowed {\n            bail!(\n                \"the `-Z` flag is only accepted on the nightly channel of Cargo, \\\n                 but this is the `{}` channel\\n\\","sourceCodeStart":1217,"sourceCodeEnd":1253,"githubUrl":"https://github.com/rust-lang/cargo/blob/42eee92bc9aa4449f4e25d84e4ceb1cf8e0f87f9/src/workspace/features.rs#L1217-L1253","documentation":"`GitoxideFeatures::parse_gitoxide` validates the values given to the unstable `-Zgit` flag (via `visit_str`/`add`). Only `fetch` and `checkout` are accepted; any other token causes this bail. The message also points to `-Zgit=shallow-index,shallow-deps` for shallow-fetch related options.","triggerScenarios":"Invoking cargo with a nightly `-Zgit` value other than `fetch` or `checkout`, e.g. `-Zgit=shallow` or `-Zgit=fetch,shallow`, or RUSTC_BOOTSTRAP-based `-Zgit` in RUSTFLAGS/config env.","commonSituations":"Following outdated blog posts/issues that reference renamed or removed gitoxide feature tokens; typos like `fech`; confusing the shallow-fetch flags with the gitoxide feature list.","solutions":["Use only `-Zgit=fetch` and/or `-Zgit=checkout` (e.g. `-Zgit=fetch,checkout`).","For shallow clones of git dependencies, use `-Zgit=shallow-index,shallow-deps` instead.","Check `cargo -Z help` / current nightly docs for the valid token list, as unstable flags change between releases.","Remove the `-Zgit` flag entirely on stable Rust, where it is not accepted anyway."],"exampleFix":"// before\ncargo +nightly build -Zgit=shallow\n// after\ncargo +nightly build -Zgit=fetch,checkout -Zgit=shallow-index,shallow-deps","handlingStrategy":"validation","validationCode":"let valid = [\"fetch\", \"checkout\"];\nfor tok in std::env::args().filter(|a| a.starts_with(\"-Zgit=\")) {\n    for v in tok.trim_start_matches(\"-Zgit=\").split(',') {\n        assert!(valid.contains(&v) || v.starts_with(\"shallow\"), \"invalid -Zgit value: {v}\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep -Z flags in a cargo config alias (e.g. `[alias] nightly = \\\"-Zgit=fetch,checkout\\\"`) maintained against current nightly docs.","Re-check unstable flag syntax after every Rust nightly upgrade.","Consult `cargo -Z help` rather than stale blog posts or old issue threads."],"tags":["cargo","unstable-flags","cli","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"42eee92bc9aa4449f4e25d84e4ceb1cf8e0f87f9","analyzedAt":"2026-09-08T04:50:20.151Z","contentChangedAt":"2026-09-08T04:50:20.151Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}