spacedriveapp/spacedrive · error

Failed to update entry: {}

Error message

Failed to update entry: {}

What it means

DatabaseStorage::update_entry failed while applying new metadata (size, modified, kind) to an existing entry during change detection; the sea_orm error is wrapped with the entry id available in EntryRef. The entry was found moments earlier, so failures are usually write-side: locks, constraints, or the row disappearing mid-update.

Source

Thrown at core/src/ops/indexing/change_detection/persistent.rs:270

		let entry = entities::entry::Entity::find_by_id(entry_id)
			.one(&self.db)
			.await?
			.ok_or_else(|| anyhow::anyhow!("Entry not found after creation"))?;

		Ok(EntryRef {
			id: entry.id,
			uuid: entry.uuid,
			path: metadata.path.clone(),
			kind: metadata.kind,
		})
	}

	async fn update(&mut self, entry: &EntryRef, metadata: &DirEntry) -> Result<()> {
		use crate::ops::indexing::database_storage::DatabaseStorage;

		DatabaseStorage::update_entry(&self.db, entry.id, metadata)
			.await
			.map_err(|e| anyhow::anyhow!("Failed to update entry: {}", e))?;

		Ok(())
	}

	async fn move_entry(
		&mut self,
		entry: &EntryRef,
		old_path: &Path,
		new_path: &Path,
		new_parent_path: &Path,
	) -> Result<()> {
		use crate::domain::addressing::SdPath;
		use crate::ops::indexing::database_storage::DatabaseStorage;
		use crate::ops::indexing::state::IndexerState;

		let mut state = IndexerState::new(&SdPath::local(old_path));

		// Cache Management: Check cache first, then query DB if needed

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Read the wrapped inner error to distinguish 'row not found' ( benign race, delete already handled it) from lock/constraint failures
  2. Treat update-of-deleted-row as success (Ok(())) since the delete path owns the state now
  3. Serialize indexing jobs per library to reduce write contention
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(e) = DatabaseStorage::update_entry(&self.db, entry.id, metadata).await {
    if e.to_string().contains("RecordNotFound") || e.to_string().contains("0 rows") {
        // entry deleted concurrently; delete path owns the state now
        return Ok(());
    }
    return Err(anyhow::anyhow!("Failed to update entry: {}", e));
}

Prevention

When it happens

Trigger: Entry deleted between find_by_path and update; DB busy/locked under concurrent writers; a constraint triggered by the new metadata values.

Common situations: Rapid modify-then-delete sequences from the watcher; multiple indexer jobs on one library; long transactions from another component holding write locks.

Related errors


AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16). Data as JSON: /api/errors/4c206ecc44f4cf34. Report an issue: GitHub.