BoundaryML/baml · error

reports contained no artifacts to bake

Error message

reports contained no artifacts to bake

What it means

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.

Source

Thrown at baml_language/crates/tools_size_gate/src/main.rs:432

        if !report.ok {
            violations += 1;
        }
        for artifact in &report.artifacts {
            let measurement = ArtifactMeasurement {
                file_bytes: artifact.file_bytes,
                stripped_bytes: artifact.stripped_bytes,
                gzip_bytes: artifact.gzip_bytes,
                sections: BTreeMap::new(),
            };
            by_platform
                .entry(artifact.platform.clone())
                .or_default()
                .insert(artifact.artifact.clone(), measurement);
        }
    }

    if by_platform.is_empty() {
        anyhow::bail!("reports contained no artifacts to bake");
    }

    let git_sha = args
        .git_sha
        .map(str::to_owned)
        .or_else(|| head_sha.clone())
        .or_else(|| current_git_sha(&workspace_root));
    let timestamp = now_iso8601();

    // Write each platform baseline, preserving any artifact already in the
    // file that this batch of reports didn't cover. Skip the write entirely
    // when the measured sizes are unchanged — bumping `recorded_at`/`git_sha`
    // on every run would churn a no-op baseline-refresh PR daily.
    let mut changed = false;
    for (platform, artifacts) in &by_platform {
        let path = baseline_path(&workspace_root, &config.baseline_dir, platform);
        let existing = PlatformBaseline::load(&path)?;
        let mut merged = match &existing {

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Verify the report files passed to bake are the JSONs produced by `size-gate record`
  2. Inspect a report file to confirm it contains artifact measurements
  3. Regenerate reports with size-gate record before baking
  4. Check the file paths/glob actually match existing reports

Example fix

// before
size-gate bake --reports empty-dir/*.json
// after
size-gate record ...   # produce reports first
size-gate bake --reports target/size-gate-reports/*.json
Defensive patterns

Strategy: validation

Validate before calling

let reports: Vec<Report> = files.iter().map(parse_report).collect::<Result<_,_>>()?;
let total: usize = reports.iter().map(|r| r.artifacts.len()).sum();
if total == 0 { eprintln!("no artifacts in reports; run `size-gate record` first"); std::process::exit(1); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/d40c6cefc5e0906d. Report an issue: GitHub.