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

Job {name} not found. The following jobs are available: {}

Error message

Job {name} not found. The following jobs are available:
{}

What it means

Thrown by find_linux_job when no job in the provided slice has a name equal to the requested name. It then lists all jobs whose os field contains 'ubuntu' (the Linux-executable jobs), sorted alphabetically, so the caller can correct the name. This is the local-execution lookup path.

Source

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

        RunType::MainJob => "main",
    };

    eprintln!("Output");
    eprintln!("jobs={jobs:?}");
    eprintln!("run_type={run_type}");
    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. Read the list of available jobs printed in the error message and copy the exact name.
  2. Confirm the job is in the pr or auto bucket (find_linux_job only receives one of those slices), not optional_jobs.
  3. Check jobs.yml for the canonical name, including any -alt suffix.

Example fix

// before
$ citool local --job dist-x86_64-linux
Error: Job dist-x86_64-linux not found. The following jobs are available:
dist-x86_64-linux-alt, dist-x86_64-unknown-linux-gnu, ...

// after
$ citool local --job dist-x86_64-unknown-linux-gnu
Defensive patterns

Strategy: validation

Validate before calling

// Before calling find_linux_job, confirm the name exists in the slice.
let exists = jobs.iter().any(|j| j.name == name);
if !exists {
    eprintln!("Job '{name}' not in list. Available: {:?}",
        jobs.iter().map(|j| j.name.as_str()).collect::<Vec<_>>());
    return Ok(());
}

Try / catch

match jobs::find_linux_job(jobs, &name) {
    Ok(job) => { /* proceed */ }
    Err(e) => {
        // e already lists available Linux jobs; surface and exit gracefully
        eprintln!("{e:#}");
        std::process::exit(2);
    }
}

Prevention

When it happens

Trigger: Calling run-workflow-locally (or find_linux_job directly) with a job name that does not exactly match any Job.name in the pr_jobs or auto_jobs slice; passing a display name instead of the canonical name; casing or suffix mismatch (e.g. omitting -alt).

Common situations: Typo in the job name on the command line; the job exists only in optional_jobs (which local execution does not search); the job name changed in jobs.yml but the caller used the old name.

Related errors


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