{"record":{"id":"9b36b1992a6a297c","repo":"nikivdev/code","slug":"no-task-failures-recorded-yet","errorCode":null,"errorMessage":"No task failures recorded yet.","messagePattern":"No task failures recorded yet\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/failure.rs","lineNumber":331,"sourceCode":"        }\n    }\n\n    if entries.is_empty() && latest_path.is_file() {\n        entries.push(load_entry_from_path(&latest_path)?);\n    }\n\n    entries.sort_by(|a, b| b.record.ts.cmp(&a.record.ts).then_with(|| b.id.cmp(&a.id)));\n    if entries.len() > limit {\n        entries.truncate(limit);\n    }\n    Ok(entries)\n}\n\nfn latest_entry() -> Result<FailureEntry> {\n    recent_entries(1)?\n        .into_iter()\n        .next()\n        .ok_or_else(|| anyhow::anyhow!(\"No task failures recorded yet.\"))\n}\n\nfn resolve_entry(id: Option<&str>) -> Result<FailureEntry> {\n    let Some(id) = id else {\n        return latest_entry();\n    };\n\n    let path_candidate = PathBuf::from(id);\n    if (path_candidate.is_absolute() || id.contains(std::path::MAIN_SEPARATOR))\n        && path_candidate.exists()\n    {\n        return load_entry_from_path(&path_candidate);\n    }\n\n    let limit = 200;\n    recent_entries(limit)?\n        .into_iter()\n        .find(|entry| {","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/failure.rs#L313-L349","documentation":"`latest_entry` reads the most recent task-failure record via `recent_entries(1)` and errors when the log is empty — there is no failure entry to return. It backs `f last`/`run_last` and `resolve_entry` (the default when no ID is given), so the command cannot proceed without any recorded failure.","triggerScenarios":"Running the 'last failure' command (or omitting an ID so it resolves to the latest entry) before any task failure has ever been recorded in the failure log.","commonSituations":"Fresh checkout/CI workspace with an empty failure store; after cleaning logs; expecting a failure that never got recorded because prior runs succeeded or logging was skipped.","solutions":["Run a task that fails (or fix your workflow) so a failure gets recorded, then retry","Verify you are in the right workspace/project — the failure log may live elsewhere","Pass an explicit entry ID if you intended a specific failure rather than the latest","Check the failure log location/permissions if you believe entries exist"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if recent_entries(1).map(|v| v.is_empty()).unwrap_or(true) {\n    eprintln!(\"No failures recorded yet.\");\n    std::process::exit(0);\n}","typeGuard":null,"tryCatchPattern":"match latest_entry() {\n    Ok(entry) => show(entry),\n    Err(e) if e.to_string().contains(\"No task failures recorded\") => {\n        println!(\"Nothing to show — no failures logged yet.\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Only query the latest failure after a failing run exists","Check failure-log emptiness explicitly in scripts","Run commands from the correct workspace where the log lives","Treat empty-history as an expected state, not a crash"],"tags":["cli","state","empty-log"],"backgroundTag":"no-failure-history","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}