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

Patterns `{}` did not match any auto jobs

Error message

Patterns `{}` did not match any auto jobs

What it means

When citool expands try-job patterns via RunType::TryJob (jobs.rs:292-313), each pattern is matched against auto and optional jobs. If a pattern matches no jobs at all it is collected into unknown_patterns, and once all patterns are processed the error 'Patterns ... did not match any auto jobs' is returned with the comma-joined list.

Source

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

        RunType::PullRequest => (db.pr_jobs.clone(), "PR", &db.envs.pr_env),
        RunType::TryJob { job_patterns } => {
            let jobs = if let Some(patterns) = job_patterns {
                let mut jobs: Vec<Job> = vec![];
                let mut unknown_patterns = vec![];
                for pattern in patterns {
                    let matched_jobs = db.find_auto_or_optional_jobs_by_pattern(pattern);
                    if matched_jobs.is_empty() {
                        unknown_patterns.push(pattern.clone());
                    } else {
                        for job in matched_jobs {
                            if !jobs.iter().any(|j| j.name == job.name) {
                                jobs.push(job);
                            }
                        }
                    }
                }
                if !unknown_patterns.is_empty() {
                    return Err(anyhow::anyhow!(
                        "Patterns `{}` did not match any auto jobs",
                        unknown_patterns.join(", ")
                    ));
                }
                if jobs.len() > MAX_TRY_JOBS_COUNT {
                    return Err(anyhow::anyhow!(
                        "It is only possible to schedule up to {MAX_TRY_JOBS_COUNT} custom jobs, received {} custom jobs expanded from {} pattern(s)",
                        jobs.len(),
                        patterns.len()
                    ));
                }
                jobs
            } else {
                db.try_jobs.clone()
            };
            (jobs, "try", &db.envs.try_env)
        }
        RunType::AutoJob => (db.auto_jobs.clone(), "auto", &db.envs.auto_env),

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Check the current auto/optional job names and fix the typo or use an exact existing name.
  2. List available jobs (e.g. via citool's job listing) before submitting the try-job pattern.
  3. Verify whether the matcher is glob/substring/exact and adjust the pattern accordingly.
  4. Remove patterns that target jobs that no longer exist.

Example fix

# before
@bors try ping=foo dist-x86_64-unkown-linux   # typo -> error

# after
@bors try ping=foo dist-x86_64-unknown-linux-gnu
Defensive patterns

Strategy: validation

Validate before calling

// Expand patterns the same way citool does and check for emptiness.
fn matches_any(pattern: &str, job_names: &[&str]) -> bool {
    job_names.iter().any(|n| pattern_matches(pattern, n))
}
// if patterns.iter().any(|p| !matches_any(p, &known_names)) { return Err(...) }

Prevention

When it happens

Trigger: Running a try build with @bors try job-patterns that do not correspond to any existing auto or optional job name — a typo, an outdated name, or a glob that matches nothing (note matching is done via find_auto_or_optional_jobs_by_pattern, not regex).

Common situations: Renaming/removing a job but referencing the old name in a try-job pattern; typos in the pattern; expecting shell-glob semantics when the matcher uses a different scheme.

Related errors


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