rust-lang/rust · error · anyhow::Error
unsupported channel: {}
Error message
unsupported channel: {} What it means
Thrown by Tool::new in bump-stage0 when the contents of src/ci/channel (trimmed) is not exactly 'stable', 'beta', or 'nightly'. The channel string drives which manifest and which components (e.g. rustfmt only on nightly) are fetched, so an unrecognized value cannot be processed.
Source
Thrown at src/tools/bump-stage0/src/main.rs:29
const RUSTFMT_COMPONENTS: &[&str] = &["rustfmt-preview", "rustc"];
struct Tool {
config: Stage0Config,
channel: Channel,
compiler_date: Option<String>,
rustfmt_date: Option<String>,
version: [u16; 3],
checksums: IndexMap<String, String>,
}
impl Tool {
fn new(compiler_date: Option<String>, rustfmt_date: Option<String>) -> Result<Self, Error> {
let channel = match std::fs::read_to_string("src/ci/channel")?.trim() {
"stable" => Channel::Stable,
"beta" => Channel::Beta,
"nightly" => Channel::Nightly,
other => anyhow::bail!("unsupported channel: {}", other),
};
// Split "1.42.0" into [1, 42, 0]
let version = std::fs::read_to_string("src/version")?
.trim()
.split('.')
.map(|val| val.parse())
.collect::<Result<Vec<_>, _>>()?
.try_into()
.map_err(|_| anyhow::anyhow!("failed to parse version"))?;
let existing = parse_stage0_file();
Ok(Self {
channel,
version,
compiler_date,
rustfmt_date,View on GitHub (pinned to 7088e4b63a)
Solutions
- Inspect src/ci/channel and ensure it is exactly one of: stable, beta, nightly (no extra whitespace/casing).
- If you intentionally use a custom channel, extend the match in Tool::new to map it to a Channel variant.
- Restore the file from the upstream branch if it was clobbered.
Example fix
// before $ cat src/ci/channel nightly-test // after $ echo nightly > src/ci/channel
Defensive patterns
Strategy: validation
Validate before calling
// Validate the channel file before constructing the Tool.
let channel = std::fs::read_to_string("src/ci/channel")?.trim().to_string();
if !matches!(channel.as_str(), "stable" | "beta" | "nightly") {
eprintln!("src/ci/channel is '{channel}', expected stable|beta|nightly");
std::process::exit(1);
} Prevention
- Keep src/ci/channel to exactly one of the three supported values.
- If you fork to a custom channel, extend the match in Tool::new deliberately.
- Re-check the file after merges that might clobber it.
When it happens
Trigger: Running bump-stage0 from a branch where src/ci/channel contains an experimental or custom release-channel name; the file has trailing whitespace or a different casing (e.g. 'Nightly'); the file was accidentally overwritten or is empty.
Common situations: Fork using a custom channel name; merge accidentally clobbered src/ci/channel; building from a worktree where the file is missing.
Related errors
- missing component from manifest: {}
- failed to parse version
- url doesn't start with dist server base: {}
- rust-analyzer Language Server is not available. Please, ensu
- Failed to execute ${path} --version.
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/622a06556ff247f0.
Report an issue: GitHub.