{"record":{"id":"e1e525abfc05fe7b","repo":"rust-lang/cargo","slug":"zfix-edition-expected-a-value","errorCode":null,"errorMessage":"-Zfix-edition expected a value","messagePattern":"-Zfix-edition expected a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/workspace/features.rs","lineNumber":1430,"sourceCode":"\n            // Unstable features\n            // Sorted alphabetically:\n            \"advanced-env\" => self.advanced_env = parse_empty(k, v)?,\n            \"any-build-script-metadata\" => self.any_build_script_metadata = parse_empty(k, v)?,\n            \"avoid-dev-deps\" => self.avoid_dev_deps = parse_empty(k, v)?,\n            \"binary-dep-depinfo\" => self.binary_dep_depinfo = parse_empty(k, v)?,\n            \"bindeps\" => self.bindeps = parse_empty(k, v)?,\n            \"build-analysis\" => self.build_analysis = parse_empty(k, v)?,\n            \"build-std\" => self.build_std = Some(parse_list(v)),\n            \"build-std-features\" => self.build_std_features = Some(parse_list(v)),\n            \"codegen-backend\" => self.codegen_backend = parse_empty(k, v)?,\n            \"direct-minimal-versions\" => self.direct_minimal_versions = parse_empty(k, v)?,\n            \"dual-proc-macros\" => self.dual_proc_macros = parse_empty(k, v)?,\n            \"feature-unification\" => self.feature_unification = parse_empty(k, v)?,\n            \"fine-grain-locking\" => self.fine_grain_locking = parse_empty(k, v)?,\n            \"fix-edition\" => {\n                let fe = v\n                    .ok_or_else(|| anyhow::anyhow!(\"-Zfix-edition expected a value\"))?\n                    .parse()?;\n                self.fix_edition = Some(fe);\n            }\n            \"gc\" => self.gc = parse_empty(k, v)?,\n            \"git\" => {\n                self.git =\n                    v.map_or_else(|| Ok(Some(GitFeatures::all())), |v| parse_git(v.split(',')))?\n            }\n            \"gitoxide\" => {\n                self.gitoxide = v.map_or_else(\n                    || Ok(Some(GitoxideFeatures::all())),\n                    |v| parse_gitoxide(v.split(',')),\n                )?\n            }\n            \"host-config\" => self.host_config = parse_empty(k, v)?,\n            \"json-target-spec\" => self.json_target_spec = parse_empty(k, v)?,\n            \"hint-msrv\" => self.hint_msrv = parse_empty(k, v)?,\n            \"next-lockfile-bump\" => self.next_lockfile_bump = parse_empty(k, v)?,","sourceCodeStart":1412,"sourceCodeEnd":1448,"githubUrl":"https://github.com/rust-lang/cargo/blob/98a09e7e7d62850f14e5b6132101fc1edd19a16f/src/workspace/features.rs#L1412-L1448","documentation":"Thrown while parsing the -Z (unstable) feature flags when the 'fix-edition' key is present but its value is None. Unlike flags parsed with parse_empty (which accept no value), fix-edition requires an explicit edition value that is then parsed via FromStr. The ok_or_else converts the Option<String> into an error when it is None.","triggerScenarios":"Passing -Z fix-edition with no '=VALUE' on the command line or in a config that sets the key to an empty/flag form. Internally, GitFeatures::parse or the -Z parser receives (k='fix-edition', v=None).","commonSituations":"A user runs `cargo fix -Z fix-edition` without appending the target edition. A script or config writes fix-edition as a boolean flag rather than a key=value pair. A wrapper tool forwards -Z flags incorrectly, dropping the value.","solutions":["Provide an edition value: -Z fix-edition=2024 (or whichever edition you are migrating to).","Check the calling code that constructs the -Z flag list and ensure value-bearing flags include '=value'.","Consult `cargo fix --help` and the unstable documentation for the correct syntax."],"exampleFix":"# before\ncargo fix -Z fix-edition\n\n# after\ncargo fix -Z fix-edition=2024","handlingStrategy":"validation","validationCode":"fn parse_fix_edition(v: Option<&str>) -> Result<Edition, String> {\n    let raw = v.ok_or(\"-Zfix-edition requires a value, e.g. -Zfix-edition=2024\")?;\n    raw.parse().map_err(|e: _| format!(\"invalid edition `{raw}`: {e}\"))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass -Z flags as key=value when the flag requires a value.","Validate the -Z flag list before forwarding to cargo.","Keep a reference of value-bearing unstable flags in wrapper tooling."],"tags":["cargo","unstable","cli","edition","fix"],"backgroundTag":null,"analyzedSha":"98a09e7e7d62850f14e5b6132101fc1edd19a16f","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}