{"record":{"id":"7cfabaa870875f33","repo":"rust-lang/cargo","slug":"unknown-vcs-specification-schema","errorCode":null,"errorMessage":"unknown vcs specification: `{}`","messagePattern":"unknown vcs specification: `(.+?)`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/context/schema.rs","lineNumber":114,"sourceCode":"            VersionControl::Hg => \"hg\",\n            VersionControl::Pijul => \"pijul\",\n            VersionControl::Fossil => \"fossil\",\n            VersionControl::NoVcs => \"none\",\n        }\n    }\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/// Definition of a source in a config file.\n#[derive(Debug, Deserialize)]\n#[serde(rename_all = \"kebab-case\")]\npub struct SourceConfigDef {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/rust-lang/cargo/blob/98a09e7e7d62850f14e5b6132101fc1edd19a16f/src/context/schema.rs#L96-L132","documentation":"This error is raised when a `VersionControl` value cannot be parsed from a string via its `FromStr` implementation (used during config deserialization). The string must exactly match one of the supported VCS names: `git`, `hg`, `pijul`, `fossil`, or `none`. Any other value (including typos, capitalization differences, or empty strings) aborts with `unknown vcs specification: \\`<input>\\``.","triggerScenarios":"Deserializing a config (e.g. cargo/alternative-registry style config) whose `vcs` key (or equivalent field of type `VersionControl`) contains a value other than the five recognized strings, e.g. `vcs = \"Git\"` (capitalized), `vcs = \"mercurial\"`, or a variable left unexpanded like the literal `{}` shown in the message when formatting substitutes the offending input.","commonSituations":"Typing `vcs = \"git\"` with stray whitespace or wrong case; using a full VCS name like `mercurial` or `subversion` instead of `hg`; templated config where a placeholder was not substituted (message shows a literal `{}`); migrating configs from tools that accept different VCS names.","solutions":["Open the config file and change the `vcs` value to one of exactly: `git`, `hg`, `pijul`, `fossil`, or `none` (lowercase, no whitespace).","If a template/variable was supposed to be substituted (message shows a literal `{}`), fix the templating/substitution step so a real VCS name is written.","Check the docs for the config schema to confirm which VCS aliases are supported; there are none beyond the five listed — e.g. `mercurial` is not accepted, use `hg`.","If you need a new VCS supported, this is upstream code (src/context/schema.rs `from_str`); file/patch the library to add the match arm."],"exampleFix":"// before (config)\nvcs = \"mercurial\"\n\n// after (config)\nvcs = \"hg\"","handlingStrategy":"validation","validationCode":"const VALID_VCS: &[&str] = &[\"git\", \"hg\", \"pijul\", \"fossil\", \"none\"];\nfn is_valid_vcs(s: &str) -> bool {\n    VALID_VCS.contains(&s.trim())\n}\n// before deserializing config:\nassert!(is_valid_vcs(cfg.vcs.as_str()), \"unsupported vcs: {}\", cfg.vcs);","typeGuard":"fn is_known_vcs(s: &str) -> Option<VersionControl> {\n    match s.trim() {\n        \"git\" => Some(VersionControl::Git),\n        \"hg\" => Some(VersionControl::Hg),\n        \"pijul\" => Some(VersionControl::Pijul),\n        \"fossil\" => Some(VersionControl::Fossil),\n        \"none\" => Some(VersionControl::NoVcs),\n        _ => None,\n    }\n}","tryCatchPattern":"match VersionControl::from_str(raw) {\n    Ok(vcs) => /* proceed */,\n    Err(e) => eprintln!(\"config error: {e}; expected one of git, hg, pijul, fossil, none\"),\n}","preventionTips":["Validate the `vcs` field against the allowed list before deserializing or at config-load time with a clear error message.","Never write templated placeholders directly into config; assert substitution completed (reject values containing `{`).","Use the library's own `VersionControl` enum in tooling instead of raw strings so invalid values fail at compile time.","Keep values lowercase and trimmed; there are no aliases (e.g. `mercurial` -> `hg`)."],"tags":["rust","config","serialization","vcs","fromstr"],"backgroundTag":"invalid-enum-value","analyzedSha":"98a09e7e7d62850f14e5b6132101fc1edd19a16f","analyzedAt":"2026-09-16T13:30:09.367Z","contentChangedAt":"2026-09-16T13:30:09.367Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}