rust-lang/rust · error · anyhow::Error

url doesn't start with dist server base: {}

Error message

url doesn't start with dist server base: {}

What it means

Thrown by collect_checksums (the per-target url/hash loop) when a target's url field does not start with the configured dist_server prefix (config.dist_server + '/'). The prefix is stripped so the checksum map is keyed by a server-relative path; a url that is not under the dist server base would produce a wrong key.

Source

Thrown at src/tools/bump-stage0/src/main.rs:196

            date: manifest.date,
            version: "nightly".into(),
        }))
    }

    fn collect_checksums(&mut self, manifest: &Manifest, components: &[&str]) -> Result<(), Error> {
        let prefix = format!("{}/", self.config.dist_server);
        for component in components {
            let pkg = manifest
                .pkg
                .get(*component)
                .ok_or_else(|| anyhow::anyhow!("missing component from manifest: {}", component))?;
            for target in pkg.target.values() {
                for pair in &[(&target.url, &target.hash), (&target.xz_url, &target.xz_hash)] {
                    if let (Some(url), Some(sha256)) = pair {
                        let url = url
                            .strip_prefix(&prefix)
                            .ok_or_else(|| {
                                anyhow::anyhow!("url doesn't start with dist server base: {}", url)
                            })?
                            .to_string();
                        self.checksums.insert(url, sha256.clone());
                    }
                }
            }
        }
        for artifact in manifest.artifacts.values() {
            for targets in artifact.target.values() {
                for target in targets {
                    let url = target
                        .url
                        .strip_prefix(&prefix)
                        .ok_or_else(|| {
                            anyhow::anyhow!(
                                "url doesn't start with dist server base: {}",
                                target.url
                            )

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Compare the failing url (printed in the error) against config.dist_server in src/stage0.
  2. Update config.dist_server to the base actually used by the manifest URLs, or fix the manifest so URLs are under the configured base.
  3. If a target legitimately uses an external URL, special-case it rather than relying on the prefix strip.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

// Before stripping the prefix, check the url is under the configured base.
let prefix = format!("{}/", config.dist_server);
for target in pkg.target.values() {
    if let Some(url) = &target.url {
        if !url.starts_with(&prefix) {
            eprintln!("target url {url} is not under dist server base {}; skipping", config.dist_server);
        }
    }
}

Prevention

When it happens

Trigger: A component target url in the manifest points to a different host or CDN than config.dist_server; the dist_server value in src/stage0 was changed but the manifest still references the old base; a manifest entry uses an absolute URL to an external mirror.

Common situations: Editing the dist_server base in src/stage0 config section; switching manifest source between stable and nightly where URLs differ; an upstream manifest bug publishing an off-base URL.

Related errors


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/d5fa2f15f5909365. Report an issue: GitHub.