{"record":{"id":"b9ba0b0210d0fc2e","repo":"rust-lang/rust","slug":"only-linux-jobs-can-be-executed-locally","errorCode":null,"errorMessage":"Only Linux jobs can be executed locally","messagePattern":"Only Linux jobs can be executed locally","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ci/citool/src/jobs.rs","lineNumber":413,"sourceCode":"    println!(\"jobs={}\", serde_json::to_string(&jobs)?);\n    println!(\"run_type={run_type}\");\n\n    Ok(())\n}\n\npub fn find_linux_job<'a>(jobs: &'a [Job], name: &str) -> anyhow::Result<&'a Job> {\n    let Some(job) = jobs.iter().find(|j| j.name == name) else {\n        let available_jobs: Vec<&Job> = jobs.iter().filter(|j| j.is_linux()).collect();\n        let mut available_jobs =\n            available_jobs.iter().map(|j| j.name.to_string()).collect::<Vec<_>>();\n        available_jobs.sort();\n        return Err(anyhow::anyhow!(\n            \"Job {name} not found. The following jobs are available:\\n{}\",\n            available_jobs.join(\", \")\n        ));\n    };\n    if !job.is_linux() {\n        return Err(anyhow::anyhow!(\"Only Linux jobs can be executed locally\"));\n    }\n\n    Ok(job)\n}\n","sourceCodeStart":395,"sourceCodeEnd":418,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/ci/citool/src/jobs.rs#L395-L418","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pick a Linux job from the available-jobs list to reproduce the logic locally.","For non-Linux platform testing, run the job in GitHub Actions or on the target platform directly rather than via citool local.","If you added a new Linux job, ensure its os field contains 'ubuntu' in jobs.yml."],"exampleFix":"// before\n$ citool local --job x86_64-apple-darwin\nError: Only Linux jobs can be executed locally\n\n// after (choose an equivalent Linux job)\n$ citool local --job x86_64-unknown-linux-gnu","handlingStrategy":"validation","validationCode":"// Before local execution, confirm the chosen job is Linux.\nif let Some(job) = jobs.iter().find(|j| j.name == name) {\n    if !job.is_linux() {\n        eprintln!(\"Job '{}' runs on '{}' and cannot be executed locally\", name, job.os);\n        return Ok(());\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only attempt local execution for jobs whose os field contains 'ubuntu'.","For platform-specific behavior, test in GitHub Actions or on the target OS.","When adding a Linux job, set its os to an ubuntu runner string."],"tags":["ci","citool","local-execution","platform"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}