From f0782aa243a2d61f1e4a83eebabcc5f4354f34c2 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Fri, 8 Aug 2025 16:01:48 +0200 Subject: [PATCH] agent: Don't error when the agent navigation history hasn't been persisted (#35863) This causes us to log an unrecognizable error on every startup otherwise Release Notes: - N/A --- crates/agent/src/history_store.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/agent/src/history_store.rs b/crates/agent/src/history_store.rs index 89f75a72bd..eb39c3e454 100644 --- a/crates/agent/src/history_store.rs +++ b/crates/agent/src/history_store.rs @@ -212,7 +212,16 @@ impl HistoryStore { fn load_recently_opened_entries(cx: &AsyncApp) -> Task>> { cx.background_spawn(async move { let path = paths::data_dir().join(NAVIGATION_HISTORY_PATH); - let contents = smol::fs::read_to_string(path).await?; + let contents = match smol::fs::read_to_string(path).await { + Ok(it) => it, + Err(e) if e.kind() == std::io::ErrorKind::NotFound => { + return Ok(Vec::new()); + } + Err(e) => { + return Err(e) + .context("deserializing persisted agent panel navigation history"); + } + }; let entries = serde_json::from_str::>(&contents) .context("deserializing persisted agent panel navigation history")? .into_iter()