{"record":{"id":"88f71d8ccccb82af","repo":"rust-lang/cargo","slug":"no-timing-data-found-in-log","errorCode":null,"errorMessage":"no timing data found in log","messagePattern":"no timing data found in log","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ops/cargo_report/timings.rs","lineNumber":351,"sourceCode":"                    e.get_mut().data.duration = elapsed;\n                    e.get_mut().data.unblocked_units = unblocked;\n                }\n                Entry::Vacant(_) => {\n                    tracing::warn!(\"unit {index} ended, but it has no start recorded\");\n                }\n            },\n            _ => {} // skip non-timing logs\n        }\n    }\n\n    // A build can legitimately have no units at all, such as an idle\n    // `cargo test` with `test = false` and `doctest = false`,\n    // so `--timings` always renders its report.\n    // `cargo report timings` instead treats a unit-less\n    // log as corrupted or truncated and errors out.\n    // See https://github.com/rust-lang/cargo/issues/17212.\n    if error_if_no_units && units.is_empty() {\n        anyhow::bail!(\"no timing data found in log\");\n    }\n\n    ctx.root_units = {\n        let mut root_map: IndexMap<_, Vec<_>> = IndexMap::default();\n        for index in requested_units {\n            let unit = &units[&index];\n            // Pretty much like `workspace::Target::description_named`\n            let target_desc = if unit.target.kind == \"lib\" {\n                \"lib\".to_owned()\n            } else if unit.target.kind == \"build-script\" {\n                \"build script\".to_owned()\n            } else {\n                format!(r#\" {} \"{}\"\"#, unit.target.name, unit.target.kind)\n            };\n            root_map.entry(index).or_default().push(target_desc);\n        }\n        root_map\n            .into_iter()","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/rust-lang/cargo/blob/eb98b54bc9f3c74519f43d066cb3fd02ebc88df0/src/ops/cargo_report/timings.rs#L333-L369","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# Regenerate timing data\ncargo build --timings\ncargo report timings","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn timing_log_has_units(timing_dir: &Path) -> Result<(), String> {\n    let entries: Vec<_> = std::fs::read_dir(timing_dir).map_err(|e| e.to_string())?\n        .filter_map(|e| e.ok()).collect();\n    if entries.is_empty() {\n        return Err(\"timing log directory is empty; re-run build with --timings\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cargo-report","timings","corrupted-log","empty-data"],"backgroundTag":null,"analyzedSha":"eb98b54bc9f3c74519f43d066cb3fd02ebc88df0","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}