{"record":{"id":"adddbeba937d6691","repo":"cross-rs/cross","slug":"unknown-prerelease-tag-x","errorCode":null,"errorMessage":"unknown prerelease tag {x}","messagePattern":"unknown prerelease tag (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/rustup.rs","lineNumber":318,"sourceCode":"        {\n            install_component(\"clippy\", toolchain, msg_info)?;\n        }\n    }\n    Ok(())\n}\n\nfn rustc_channel(version: &Version) -> Result<Channel> {\n    match version\n        .pre\n        .split('.')\n        .next()\n        .expect(\"rust prerelease version should contain `.`\")\n    {\n        \"\" => Ok(Channel::Stable),\n        \"dev\" => Ok(Channel::Dev),\n        \"beta\" => Ok(Channel::Beta),\n        \"nightly\" => Ok(Channel::Nightly),\n        x => eyre::bail!(\"unknown prerelease tag {x}\"),\n    }\n}\n\nimpl QualifiedToolchain {\n    fn multirust_channel_manifest_path(&self) -> PathBuf {\n        self.get_sysroot()\n            .join(\"lib/rustlib/multirust-channel-manifest.toml\")\n    }\n\n    pub fn rustc_version_string(&self) -> Result<Option<String>> {\n        let path = self.multirust_channel_manifest_path();\n        if path.exists() {\n            let contents =\n                std::fs::read(&path).wrap_err_with(|| format!(\"couldn't open file `{path:?}`\"))?;\n            let manifest: toml::value::Table = toml::from_str(std::str::from_utf8(&contents)?)?;\n            return Ok(manifest\n                .get(\"pkg\")\n                .and_then(|pkg| pkg.get(\"rust\"))","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/rustup.rs#L300-L336","documentation":"rustc_channel parses the prerelease segment of a rustc version string into a Channel enum (Stable, Dev, Beta, Nightly). When the prerelease tag after the `.` is not one of the four recognized values, it aborts with this error. The library throws it because it can only classify toolchains it explicitly knows about.","triggerScenarios":"The prerelease portion of the version string produced by rustc -vV does not exactly equal '', 'dev', 'beta', or 'nightly'. This happens when rustc_channel receives a version string with a custom or unexpected prerelease suffix.","commonSituations":"Using a custom or vendor-built toolchain whose version string has a nonstandard prerelease tag (e.g. 'nightly-2024-01-01', 'master', or a fork's own tag); parsing output from a tool other than rustc; toolchain upgrade changing version format.","solutions":["Run `rustc -vV` and inspect the prerelease part after the first `.`; use a toolchain with a standard stable/beta/nightly/dev version string","If a custom toolchain is intentional, adjust the toolchain selection so rustc_channel is only used with official rustup toolchains","Update the toolchain (rustup update) so its version matches a known channel format","Patch the match in src/rustc_channel to recognize your custom prerelease tag if you maintain the fork"],"exampleFix":"// before\n\"nightly-2024-01-01\" // arbitrary prerelease tag -> bail! \"unknown prerelease tag\"\n// after\nrustup update nightly // or pin a toolchain whose version reports exactly 'nightly'","handlingStrategy":"validation","validationCode":"fn is_known_channel(v: &str) -> bool {\n    let pre = v.split('.').nth(1).unwrap_or(\"\");\n    matches!(pre, \"\" | \"dev\" | \"beta\" | \"nightly\")\n}","typeGuard":"fn is_known_channel(pre: &str) -> bool {\n    matches!(pre, \"\" | \"dev\" | \"beta\" | \"nightly\")\n}","tryCatchPattern":"match rustc_channel(&version) {\n    Ok(ch) => use(ch),\n    Err(e) if e.to_string().contains(\"unknown prerelease tag\") => fallback_to_stable_or_skip(e),\n    Err(e) => return Err(e),\n}","preventionTips":["Only run channel detection on official rustup-installed toolchains","Parse `rustc -vV` output and validate the prerelease tag before calling the API","Log the full version string when this error occurs to spot format drift","Add tests covering all four recognized tags plus a default case"],"tags":["rust","version-parsing","toolchain"],"backgroundTag":"invalid-enum-value","analyzedSha":"8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27","analyzedAt":"2026-09-13T15:10:43.988Z","contentChangedAt":"2026-09-13T15:10:43.988Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}