rust-lang/cargo · error
no timing data found in log
Error message
no timing data found in log
What it means
Thrown by `cargo report timings` when a timing log file contains no build units at all. Unlike `--timings` (which renders a report even for unit-less builds like an idle `cargo test`), `cargo report timings` treats an empty unit set as a corrupted or truncated log and errors out.
Solutions
- Re-run the build with `--timings` to regenerate a fresh, complete timing log.
- Verify the correct timing report directory is being read (check `target/cargo-timings/cargo-timing.html`).
- Delete stale timing logs in `target/cargo-timings/` and rebuild.
Example fix
# Regenerate timing data cargo build --timings cargo report timings
Defensive patterns
Strategy: validation
Validate before calling
use std::path::Path;
fn timing_log_has_units(timing_dir: &Path) -> Result<(), String> {
let entries: Vec<_> = std::fs::read_dir(timing_dir).map_err(|e| e.to_string())?
.filter_map(|e| e.ok()).collect();
if entries.is_empty() {
return Err("timing log directory is empty; re-run build with --timings".into());
}
Ok(())
} Prevention
- Re-run `cargo build --timings` if the report is missing data.
- Do not manually edit or delete files in `target/cargo-timings/`.
- Ensure the build completes without interruption when collecting timings.
When it happens
Trigger: Running `cargo report timings` pointing at a timing log (`timing/*`) directory or file that either is empty, was truncated, or came from a build that logged no timing entries.
Common situations: The timing log was partially deleted; the log is from a very old Cargo version with incompatible format; the build was interrupted before any units were recorded; the log directory is empty.
AI-assisted analysis of rust-lang/cargo@eb98b54bc9 (2026-08-11).
Data as JSON: /api/errors/88f71d8ccccb82af.
Report an issue: GitHub.
Appendix: source
Thrown at src/ops/cargo_report/timings.rs:351
e.get_mut().data.duration = elapsed;
e.get_mut().data.unblocked_units = unblocked;
}
Entry::Vacant(_) => {
tracing::warn!("unit {index} ended, but it has no start recorded");
}
},
_ => {} // skip non-timing logs
}
}
// A build can legitimately have no units at all, such as an idle
// `cargo test` with `test = false` and `doctest = false`,
// so `--timings` always renders its report.
// `cargo report timings` instead treats a unit-less
// log as corrupted or truncated and errors out.
// See https://github.com/rust-lang/cargo/issues/17212.
if error_if_no_units && units.is_empty() {
anyhow::bail!("no timing data found in log");
}
ctx.root_units = {
let mut root_map: IndexMap<_, Vec<_>> = IndexMap::default();
for index in requested_units {
let unit = &units[&index];
// Pretty much like `workspace::Target::description_named`
let target_desc = if unit.target.kind == "lib" {
"lib".to_owned()
} else if unit.target.kind == "build-script" {
"build script".to_owned()
} else {
format!(r#" {} "{}""#, unit.target.name, unit.target.kind)
};
root_map.entry(index).or_default().push(target_desc);
}
root_map
.into_iter()View on GitHub (pinned to eb98b54bc9)