{"record":{"id":"ff4e067823de6f8e","repo":"BoundaryML/baml","slug":"expected-size-gate-reports-from-run-run-id-found","errorCode":null,"errorMessage":"expected {} size-gate reports from run {run_id}, found {}","messagePattern":"expected (.+?) size-gate reports from run (.+?), found (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/tools_size_gate/src/fetch.rs","lineNumber":140,"sourceCode":"        .with_context(|| format!(\"failed to create {}\", download_dir.display()))?;\n    gh(&[\n        \"run\",\n        \"download\",\n        &run_id,\n        \"--repo\",\n        &repo,\n        // `size-gate-*` matches the per-platform reports and NOT the\n        // `cargo-timings-size-gate-*` artifacts (different prefix).\n        \"--pattern\",\n        \"size-gate-*\",\n        \"--dir\",\n        &download_dir.to_string_lossy(),\n    ])\n    .with_context(|| format!(\"failed to download reports from run {run_id}\"))?;\n\n    let files = find_json_reports(download_dir)?;\n    if files.len() < REQUIRED_ARTIFACTS.len() {\n        bail!(\n            \"expected {} size-gate reports from run {run_id}, found {}\",\n            REQUIRED_ARTIFACTS.len(),\n            files.len()\n        );\n    }\n\n    Ok(Fetched {\n        files,\n        run_id,\n        head_sha: chosen.head_sha.clone(),\n    })\n}\n\n/// True if run `run_id` has every artifact in `REQUIRED_ARTIFACTS`.\nfn run_has_all_reports(repo: &str, run_id: u64) -> Result<bool> {\n    let names = gh(&[\n        \"api\",\n        \"--paginate\",","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/tools_size_gate/src/fetch.rs#L122-L158","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: gate fails because old run lacks new artifact\nsize-gate check --branch main\n// after: use an explicit run that has all artifacts, or supply files\nsize-gate check --branch main --run-id 1234567\n// or\nsize-gate check reports/*.json","handlingStrategy":"validation","validationCode":"let artifacts = json_run_artifacts(run_id)?;\nlet missing: Vec<_> = REQUIRED_ARTIFACTS.iter().filter(|a| !artifacts.contains(a)).collect();\nif !missing.is_empty() { eprintln!(\"run {run_id} missing artifacts: {missing:?}\"); std::process::exit(1); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["ci","artifacts","github-actions","size-gate"],"backgroundTag":"missing-required-config-field","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}