{"id":"2e54611e6ec7e21e","repo":"rust-lang/cargo","slug":"unknown-vcs-specification","errorCode":null,"errorMessage":"unknown vcs specification: `{}`","messagePattern":"unknown vcs specification: `(.+?)`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ops/cargo_new.rs","lineNumber":40,"sourceCode":"pub enum VersionControl {\n    Git,\n    Hg,\n    Pijul,\n    Fossil,\n    NoVcs,\n}\n\nimpl FromStr for VersionControl {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, anyhow::Error> {\n        match s {\n            \"git\" => Ok(VersionControl::Git),\n            \"hg\" => Ok(VersionControl::Hg),\n            \"pijul\" => Ok(VersionControl::Pijul),\n            \"fossil\" => Ok(VersionControl::Fossil),\n            \"none\" => Ok(VersionControl::NoVcs),\n            other => anyhow::bail!(\"unknown vcs specification: `{}`\", other),\n        }\n    }\n}\n\nimpl<'de> de::Deserialize<'de> for VersionControl {\n    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>\n    where\n        D: de::Deserializer<'de>,\n    {\n        let s = String::deserialize(deserializer)?;\n        FromStr::from_str(&s).map_err(de::Error::custom)\n    }\n}\n\n#[derive(Debug)]\npub struct NewOptions {\n    pub version_control: Option<VersionControl>,\n    pub kind: NewProjectKind,","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/ops/cargo_new.rs#L22-L58","documentation":"Thrown by VersionControl::from_str when parsing a VCS name supplied via the --vcs flag or the [cargo-new] vcs config key. The parser only recognizes the exact lowercase tokens git, hg, pijul, fossil, none; any other string is rejected before a repository is touched. It exists to fail fast on an unsupported/typo'd VCS choice rather than silently skipping VCS setup.","triggerScenarios":"Run `cargo new --vcs svn myproj`, set `[cargo-new] vcs = \"github\"` in ~/.cargo/config.toml, or call `VersionControl::from_str(\"subversion\")` programmatically. Any token outside {git,hg,pijul,fossil,none} hits the `other` arm at cargo_new.rs:40.","commonSituations":"Typos like `--vcs git2` or `--vcs GitHub`, copy-pasting a config from a tutorial that used a non-supported value, or assuming a VCS (e.g. `svn`, `bzr`, `jj`) is supported when it is not. Case sensitivity also bites: `Git`/`GIT` are rejected.","solutions":["Use one of the supported lowercase tokens: --vcs git | hg | pijul | fossil | none","If the value came from config, edit ~/.cargo/config.toml and fix the [cargo-new] vcs entry to a supported value","Check for trailing whitespace or capitalization in the token","Omit --vcs entirely to let Cargo auto-detect (defaults to git when available)"],"exampleFix":"# before\ncargo new --vcs SVN myproj\n# after\ncargo new --vcs git myproj   # or: --vcs none","handlingStrategy":"validation","validationCode":"fn is_supported_vcs(s: &str) -> bool {\n    matches!(s, \"git\" | \"hg\" | \"pijul\" | \"fossil\" | \"none\")\n}\n\n// before calling cargo or parsing config:\nlet vcs = read_vcs_from_config_or_args();\nassert!(is_supported_vcs(vcs), \"unsupported vcs: {vcs}\");","typeGuard":"const SUPPORTED_VCS: &[&str] = &[\"git\", \"hg\", \"pijul\", \"fossil\", \"none\"];\nfn isVersionControl(s: string): s is typeof SUPPORTED_VCS[number] {\n  return (SUPPORTED_VCS as readonly string[]).includes(s);\n}","tryCatchPattern":null,"preventionTips":["Keep VCS choices in a single config constant validated at startup","Avoid free-form user input for --vcs; use an enum/choice list in CLI parsers","Document the five accepted tokens wherever VCS configuration is exposed"],"tags":["cargo-new","vcs","config","cli-args"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}