{"record":{"id":"d40c6cefc5e0906d","repo":"BoundaryML/baml","slug":"reports-contained-no-artifacts-to-bake","errorCode":null,"errorMessage":"reports contained no artifacts to bake","messagePattern":"reports contained no artifacts to bake","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/tools_size_gate/src/main.rs","lineNumber":432,"sourceCode":"        if !report.ok {\n            violations += 1;\n        }\n        for artifact in &report.artifacts {\n            let measurement = ArtifactMeasurement {\n                file_bytes: artifact.file_bytes,\n                stripped_bytes: artifact.stripped_bytes,\n                gzip_bytes: artifact.gzip_bytes,\n                sections: BTreeMap::new(),\n            };\n            by_platform\n                .entry(artifact.platform.clone())\n                .or_default()\n                .insert(artifact.artifact.clone(), measurement);\n        }\n    }\n\n    if by_platform.is_empty() {\n        anyhow::bail!(\"reports contained no artifacts to bake\");\n    }\n\n    let git_sha = args\n        .git_sha\n        .map(str::to_owned)\n        .or_else(|| head_sha.clone())\n        .or_else(|| current_git_sha(&workspace_root));\n    let timestamp = now_iso8601();\n\n    // Write each platform baseline, preserving any artifact already in the\n    // file that this batch of reports didn't cover. Skip the write entirely\n    // when the measured sizes are unchanged — bumping `recorded_at`/`git_sha`\n    // on every run would churn a no-op baseline-refresh PR daily.\n    let mut changed = false;\n    for (platform, artifacts) in &by_platform {\n        let path = baseline_path(&workspace_root, &config.baseline_dir, platform);\n        let existing = PlatformBaseline::load(&path)?;\n        let mut merged = match &existing {","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/tools_size_gate/src/main.rs#L414-L450","documentation":"cmd_bake collects artifact measurements from all provided report files grouped by platform. If the resulting `by_platform` map is empty, there is nothing to bake into the baseline file, so it bails. This guards against writing an empty/meaningless baseline.","triggerScenarios":"Running `size-gate bake` with report files that contain zero artifact measurements — e.g. empty files, wrong file paths, or JSON reports whose artifact entries failed to parse/aggregate.","commonSituations":"Passing the wrong directory of JSONs to bake; reports generated by an older format; all report files being empty placeholders; glob matching nothing so only defaults are present.","solutions":["Verify the report files passed to bake are the JSONs produced by `size-gate record`","Inspect a report file to confirm it contains artifact measurements","Regenerate reports with size-gate record before baking","Check the file paths/glob actually match existing reports"],"exampleFix":"// before\nsize-gate bake --reports empty-dir/*.json\n// after\nsize-gate record ...   # produce reports first\nsize-gate bake --reports target/size-gate-reports/*.json","handlingStrategy":"validation","validationCode":"let reports: Vec<Report> = files.iter().map(parse_report).collect::<Result<_,_>>()?;\nlet total: usize = reports.iter().map(|r| r.artifacts.len()).sum();\nif total == 0 { eprintln!(\"no artifacts in reports; run `size-gate record` first\"); std::process::exit(1); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `size-gate record` to generate fresh reports before bake","Check report file sizes > 0 before baking","Use an explicit, verified list of report paths rather than a broad glob","Validate report JSON schema after format changes"],"tags":["baseline","size-gate","empty-input","ci"],"backgroundTag":"empty-result-set","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"}