{"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":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/workspace/features.rs","lineNumber":1447,"sourceCode":"            \"advanced-env\" => self.advanced_env = parse_empty(k, v)?,\n            \"any-build-script-metadata\" => self.any_build_script_metadata = parse_empty(k, v)?,\n            \"asymmetric-token\" => self.asymmetric_token = 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-dir-new-layout\" => self.build_dir_new_layout = 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            \"cargo-lints\" => self.cargo_lints = parse_empty(k, 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            \"min-publish-age\" => self.min_publish_age = parse_empty(k, v)?,\n            \"hint-msrv\" => self.hint_msrv = parse_empty(k, v)?,","sourceCodeStart":1429,"sourceCodeEnd":1465,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/workspace/features.rs#L1429-L1465","documentation":"Thrown while parsing unstable feature flags in src/workspace/features.rs:1447. The `-Z fix-edition` flag is a value-taking feature (it needs a target edition like `2024`), parsed via `parse_empty`-style logic that calls `v.ok_or_else(...)`. Supplying the flag without a value yields `None`, so cargo bails.","triggerScenarios":"Invoking `cargo +nightly fix -Z fix-edition` (no `=<edition>` and no following value), or setting `unstable.fix-edition` in `.cargo/config.toml` with no value. The match arm `\"fix-edition\" => { let fe = v.ok_or_else(...)? }`.","commonSituations":"Confusing `fix-edition` with value-less flags like `-Z bindeps`; typoing the value; nightly-only workflows copied incompletely.","solutions":["Provide the edition value: `cargo +nightly fix -Z fix-edition=2024`.","In config, write `[unstable] fix-edition = \"2024\"`.","Check `cargo +nightly -Z help` for the exact value syntax of each unstable flag."],"exampleFix":"# before\ncargo +nightly fix -Z fix-edition\n# after\ncargo +nightly fix -Z fix-edition=2024","handlingStrategy":"validation","validationCode":"// ensure value-taking unstable flags always carry a value\nfn check_fix_edition(cfg: &str) -> Result<(), String> {\n    if cfg.split_whitespace().any(|t| t == \"-Z\" || t == \"-Zfix-edition\") {\n        return Err(\"-Z fix-edition needs =<edition>\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the `flag=value` form for value-taking unstable flags.","Consult `cargo +nightly -Z help` for each flag's arity.","Pin nightly versions in CI when using unstable features."],"tags":["cli","unstable","features"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}