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

Only Linux jobs can be executed locally

Error message

Only Linux jobs can be executed locally

What it means

Thrown by find_linux_job when a job with the requested name IS found, but its os field does not contain 'ubuntu' (Job::is_linux returns false). Local execution shells out to src/ci/docker/run.sh, which only supports Linux container images, so non-Linux jobs cannot be run this way.

Source

Thrown at src/ci/citool/src/jobs.rs:413

    println!("jobs={}", serde_json::to_string(&jobs)?);
    println!("run_type={run_type}");

    Ok(())
}

pub fn find_linux_job<'a>(jobs: &'a [Job], name: &str) -> anyhow::Result<&'a Job> {
    let Some(job) = jobs.iter().find(|j| j.name == name) else {
        let available_jobs: Vec<&Job> = jobs.iter().filter(|j| j.is_linux()).collect();
        let mut available_jobs =
            available_jobs.iter().map(|j| j.name.to_string()).collect::<Vec<_>>();
        available_jobs.sort();
        return Err(anyhow::anyhow!(
            "Job {name} not found. The following jobs are available:\n{}",
            available_jobs.join(", ")
        ));
    };
    if !job.is_linux() {
        return Err(anyhow::anyhow!("Only Linux jobs can be executed locally"));
    }

    Ok(job)
}

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Pick a Linux job from the available-jobs list to reproduce the logic locally.
  2. For non-Linux platform testing, run the job in GitHub Actions or on the target platform directly rather than via citool local.
  3. If you added a new Linux job, ensure its os field contains 'ubuntu' in jobs.yml.

Example fix

// before
$ citool local --job x86_64-apple-darwin
Error: Only Linux jobs can be executed locally

// after (choose an equivalent Linux job)
$ citool local --job x86_64-unknown-linux-gnu
Defensive patterns

Strategy: validation

Validate before calling

// Before local execution, confirm the chosen job is Linux.
if let Some(job) = jobs.iter().find(|j| j.name == name) {
    if !job.is_linux() {
        eprintln!("Job '{}' runs on '{}' and cannot be executed locally", name, job.os);
        return Ok(());
    }
}

Prevention

When it happens

Trigger: Calling local execution with the name of a macOS (os contains macos) or Windows (os contains windows) job, or any job whose os field is not an ubuntu runner.

Common situations: Trying to reproduce a CI failure for a platform-specific job (e.g. x86_64-apple-darwin or x86_64-pc-windows-msvc) on a Linux dev machine; a job mislabeled with a non-ubuntu os in jobs.yml.

Related errors


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