rust-lang/rust · error · anyhow::Error
Job failed
Error message
Job failed
What it means
Thrown by run_workflow_locally after the spawned docker run.sh process (configured with the job's image and environment) exits with a non-zero status. The message carries no detail because the underlying failure already printed its own output to the inherited stdout/stderr of the docker container.
Source
Thrown at src/ci/citool/src/main.rs:135
let value = match value {
Value::Bool(value) => value.to_string(),
Value::Number(value) => value.to_string(),
Value::String(value) => value.clone(),
_ => panic!("Unexpected type for environment variable {key} Only bool/number/string is supported.")
};
(key.clone(), value)
}));
init_submodule_if_needed("src/llvm-project/")?;
let mut cmd = Command::new(Path::new(DOCKER_DIRECTORY).join("run.sh"));
cmd.arg(job.image());
cmd.envs(custom_env);
eprintln!("Executing {cmd:?}");
let result = cmd.spawn()?.wait()?;
if !result.success() { Err(anyhow::anyhow!("Job failed")) } else { Ok(()) }
}
fn upload_ci_metrics(cpu_usage_csv: &Path) -> anyhow::Result<()> {
let usage = load_cpu_usage(cpu_usage_csv).context("Cannot load CPU usage from input CSV")?;
eprintln!("CPU usage\n{usage:?}");
let avg = if !usage.is_empty() { usage.iter().sum::<f64>() / usage.len() as f64 } else { 0.0 };
eprintln!("CPU usage average: {avg}");
upload_datadog_metric("avg-cpu-usage", avg).context("Cannot upload Datadog metric")?;
Ok(())
}
fn postprocess_metrics(
metrics_path: PathBuf,
parent: Option<String>,
job_name: Option<String>,View on GitHub (pinned to 7088e4b63a)
Solutions
- Scroll up through the docker container output to find the real failing command or test output.
- Re-run with the same job name after fixing the identified build/test failure.
- If the container errored on environment setup, verify the Docker image is current (./x.py setup, or rebuild the image).
- Check host resources (df -h, free -h); dist jobs need substantial disk and RAM.
Example fix
null
Defensive patterns
Strategy: try-catch
Try / catch
match run_workflow_locally(db, job_type, name) {
Ok(()) => {}
Err(e) if e.to_string() == "Job failed" => {
// The real failure was printed by the container; surface exit guidance.
eprintln!("Local job exited non-zero; review container output above.");
std::process::exit(1);
}
Err(e) => return Err(e),
} Prevention
- Run jobs inside the same Docker image CI uses to keep behavior reproducible.
- Keep host disk/RAM ample for dist jobs.
- Rebuild the Docker image after pulling dependency changes.
When it happens
Trigger: The job's build/test/CI script inside the Docker container failed: a compilation error, a test failure, a missing dependency, an out-of-memory or disk-space exhaustion, or a network error fetching artifacts.
Common situations: Reproducing a failing CI job locally where the same test failure occurs; Docker image out of date relative to the repo; insufficient host resources (disk/RAM) for a dist build; a flaky test.
Related errors
- Job {name} not found. The following jobs are available: {}
- Only Linux jobs can be executed locally
- Cannot get jobs of workflow run {workflow_run_id}: {status}
- duplicate job name `{job_name}` in section `{section}`
- PR job `{}` differs from corresponding Auto job `{}` in conf
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/62b6afa142e88f5e.
Report an issue: GitHub.