BoundaryML/baml · error
expected {} size-gate reports from run {run_id}, found {}
Error message
expected {} size-gate reports from run {run_id}, found {} What it means
The size-gate tool downloads CI artifact reports for a workflow run and expects at least one JSON report per required artifact. If `find_json_reports` finds fewer JSON files than `REQUIRED_ARTIFACTS` entries, it bails with this message. It means the run did not produce/upload all expected size reports, so the gate cannot be evaluated.
Source
Thrown at baml_language/crates/tools_size_gate/src/fetch.rs:140
.with_context(|| format!("failed to create {}", download_dir.display()))?;
gh(&[
"run",
"download",
&run_id,
"--repo",
&repo,
// `size-gate-*` matches the per-platform reports and NOT the
// `cargo-timings-size-gate-*` artifacts (different prefix).
"--pattern",
"size-gate-*",
"--dir",
&download_dir.to_string_lossy(),
])
.with_context(|| format!("failed to download reports from run {run_id}"))?;
let files = find_json_reports(download_dir)?;
if files.len() < REQUIRED_ARTIFACTS.len() {
bail!(
"expected {} size-gate reports from run {run_id}, found {}",
REQUIRED_ARTIFACTS.len(),
files.len()
);
}
Ok(Fetched {
files,
run_id,
head_sha: chosen.head_sha.clone(),
})
}
/// True if run `run_id` has every artifact in `REQUIRED_ARTIFACTS`.
fn run_has_all_reports(repo: &str, run_id: u64) -> Result<bool> {
let names = gh(&[
"api",
"--paginate",View on GitHub (pinned to bd85ce9dee)
Solutions
- Re-run the CI workflow so all required reports are uploaded, then retry the fetch
- Check the run on GitHub (gh run view <run_id>) to see which jobs/artifacts are missing
- Download the report JSONs manually and pass them as explicit file paths instead of --branch
- Verify REQUIRED_ARTIFACTS matches what the workflow actually uploads
Example fix
// before: gate fails because old run lacks new artifact size-gate check --branch main // after: use an explicit run that has all artifacts, or supply files size-gate check --branch main --run-id 1234567 // or size-gate check reports/*.json
Defensive patterns
Strategy: validation
Validate before calling
let artifacts = json_run_artifacts(run_id)?;
let missing: Vec<_> = REQUIRED_ARTIFACTS.iter().filter(|a| !artifacts.contains(a)).collect();
if !missing.is_empty() { eprintln!("run {run_id} missing artifacts: {missing:?}"); std::process::exit(1); } Prevention
- Before gating, assert the CI run's status is completed and successful
- Upload all reports as a single grouped artifact so they succeed/fail together
- Keep REQUIRED_ARTIFACTS in sync with the workflow's upload steps
- Prefer passing explicit report files over --branch in flaky CI contexts
When it happens
Trigger: Running size-gate with --branch (fetch_branch_reports) where the resolved GitHub Actions run lacks some required artifacts: the run is still in progress, some jobs failed before uploading reports, or artifacts were pruned/deleted.
Common situations: Fetching reports for a branch whose CI run partially failed; a workflow that uploads artifacts only on success; retention expiry removing artifacts; adding a new artifact to REQUIRED_ARTIFACTS while older runs did not produce it.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- no completed `{CI_WORKFLOW}` runs found on branch `{branch}`
- reports contained no artifacts to bake
- PackageInterface artifact serialization into Vec is infallib
- artifact `{name}` (kind = "pack") sets `{field}`, which is i
- `gh {}` failed: {}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/ff4e067823de6f8e.
Report an issue: GitHub.