spacedriveapp/spacedrive · error

Location not found: {}

Error message

Location not found: {}

What it means

After the library resolves, DatabaseAdapter::new looks up the location row by UUID within that library's database. If no location row matches location_id, this error fires. It means the location either was deleted, belongs to a different library, or the id is wrong; change detection has no location context to anchor path resolution.

Source

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

	pub async fn new(
		context: Arc<CoreContext>,
		library_id: Uuid,
		location_id: Uuid,
		_location_root: &Path,
		volume_backend: Option<Arc<dyn crate::volume::VolumeBackend>>,
	) -> Result<Self> {
		let library = context
			.get_library(library_id)
			.await
			.ok_or_else(|| anyhow::anyhow!("Library not found: {}", library_id))?;

		let db = library.db().conn().clone();

		let location_record = entities::location::Entity::find()
			.filter(entities::location::Column::Uuid.eq(location_id))
			.one(&db)
			.await?
			.ok_or_else(|| anyhow::anyhow!("Location not found: {}", location_id))?;

		let location_root_entry_id = location_record
			.entry_id
			.ok_or_else(|| anyhow::anyhow!("Location {} has no root entry", location_id))?;

		let volume_id = location_record.volume_id.ok_or_else(|| {
			anyhow::anyhow!(
				"Location {} has no volume_id - volume must be detected before change detection",
				location_id
			)
		})?;

		Ok(Self {
			context,
			library_id,
			location_id,
			location_root_entry_id,
			volume_id,

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Verify the location exists in the same library's DB before starting change detection
  2. Cancel any pending indexing jobs when a location is deleted (deletion should invalidate queued jobs)
  3. Confirm the location_id UUID is the one stored in entities::location (not the internal integer id)
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the location row exists in this library's DB first
let found = entities::location::Entity::find()
    .filter(entities::location::Column::Uuid.eq(location_id))
    .one(&library.db().conn())
    .await?;
if found.is_none() {
    tracing::warn!(%location_id, "location missing; skipping change detection");
    return Ok(());
}

Try / catch

match DatabaseAdapter::new(...).await {
    Ok(adapter) => adapter,
    Err(e) if e.to_string().contains("Location not found") => {
        return Ok(()); // location deleted; job is obsolete
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Passing a location_id from another library into DatabaseAdapter::new; location deleted by a user while its change-detection job was starting; querying the location in the wrong library DB.

Common situations: Location removed via UI/CLI concurrently with an indexer start; copying ids between environments; partial location deletion that removed the row before cancelling jobs.

Related errors


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