block/buzz · critical
{error} (and the local stores could not be restored: {restor
Error message
{error} (and the local stores could not be restored: {restore_errors}) What it means
Error string built in `commit_stores_with_snapshots` (desktop managed-agents storage): when committing the personas/teams stores fails, the code attempts to restore both stores from in-memory snapshots; if those restores also fail, it returns the original error annotated with every restore failure: `"{error} (and the local stores could not be restored: {restore_errors})"`. It signals double failure — the commit failed AND the rollback failed, leaving local state potentially inconsistent.
Source
Thrown at desktop/src-tauri/src/managed_agents/storage.rs:708
///
/// Both restores are attempted independently, so a restore failure in one
/// store does not prevent the other; errors from both are aggregated (I5).
pub(crate) fn commit_stores_with_snapshots(
personas_path: &Path,
teams_path: &Path,
personas_snap: StoreSnapshot,
teams_snap: StoreSnapshot,
write_personas: impl FnOnce() -> Result<(), String>,
write_teams: impl FnOnce() -> Result<(), String>,
) -> Result<(), String> {
if let Err(error) = write_personas().and_then(|()| write_teams()) {
let personas_err = restore_store(personas_path, personas_snap).err();
let teams_err = restore_store(teams_path, teams_snap).err();
let restore_errors: Vec<&str> = [personas_err.as_deref(), teams_err.as_deref()]
.into_iter()
.flatten()
.collect();
if !restore_errors.is_empty() {
return Err(format!(
"{error} (and the local stores could not be restored: {})",
restore_errors.join("; ")
));
}
return Err(error);
}
Ok(())
}
/// Maximum log file size before rotation (10 MB).
const MAX_LOG_FILE_SIZE: u64 = 10 * 1024 * 1024;
/// If `path` exceeds [`MAX_LOG_FILE_SIZE`], rotate it to `<path>.1`.
fn maybe_rotate_log(path: &Path) {
let size = match fs::metadata(path) {
Ok(m) => m.len(),
Err(_) => return,View on GitHub (pinned to eed74bde2f)
Solutions
- Close other app instances/processes holding the managed-agent store files, then retry the operation.
- Check disk space and write permissions on the store directory (e.g. ~/Library/Application Support/<app>/managed_agents).
- Back up the personas/teams store files manually, then delete or repair the corrupt ones so the app can recreate them.
- In code, perform restores to temp files plus atomic rename, and retry the restore with backoff before declaring the stores unrestorable.
Example fix
// before
return Err(format!(
"{error} (and the local stores could not be restored: {})",
restore_errors.join("; ")
));
// after
tracing::error!(restore_errors = ?restore_errors, "managed-agent commit failed and restore failed");
Err(anyhow!(
"{error} (and the local stores could not be restored: {}; inspect the store directory and back up files before retrying)",
restore_errors.join("; ")
)) Defensive patterns
Strategy: fallback
Validate before calling
// check writability of both store paths before committing
for path in [personas_path, teams_path] {
let probe = path.with_extension(".probe");
std::fs::write(&probe, b"ok").map_err(|e| format!("store dir not writable ({}): {e}", path.display()))?;
let _ = std::fs::remove_file(&probe);
} Try / catch
if let Err(commit_err) = commit_stores_with_snapshots(...).await {
match restore_stores().await {
Ok(()) => warn!("commit failed but stores restored: {commit_err}"),
Err(restore_err) => error!("commit failed AND restore failed: {commit_err}; restore: {restore_err} — back up the store directory before retrying"),
}
} Prevention
- Write stores to temp files and atomically rename so partial commits never happen.
- Snapshot before commit and verify snapshot files are readable before mutating originals.
- Monitor disk space in the app's data directory.
- Take an app-level backup of personas/teams stores before risky updates.
When it happens
Trigger: Writing personas_path or teams_path fails (disk full, permission denied, file locked by the running app) during commit, then restore_store also fails on the same paths for the same reasons while rolling back from the snapshots.
Common situations: macOS/Windows file locks while the desktop app or an agent process holds the JSON store open, full disk, antivirus blocking writes, or path permission changes after an OS update.
Related errors
- failed to install rustls crypto provider
- connect to test DB
- push HTTP client
- mesh endpoint bind on {} failed: {e}
- mesh ready-registry publish failed: {e}
AI-assisted analysis of block/buzz@eed74bde2f (2026-08-30).
Data as JSON: /api/errors/4c9622d4ea4f26b7.
Report an issue: GitHub.