spacedriveapp/spacedrive · error

Location {} has no volume_id - volume must be detected befor

Error message

Location {} has no volume_id - volume must be detected before change detection

What it means

DatabaseAdapter::new requires location_record.volume_id to be non-NULL because every entry it creates is stamped with that volume. A NULL volume_id means volume detection has not run for this location yet; the message explicitly states the ordering constraint: volume must be detected before change detection starts.

Source

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

		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,
			db,
			volume_backend,
			entry_id_cache: HashMap::new(),
		})
	}

	async fn resolve_entry_id(&self, path: &Path) -> Result<Option<i32>> {

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Run volume detection for the location first, then start change detection
  2. Ensure the location-creation pipeline enforces the create → detect-volume → index ordering
  3. Backfill volume_id for pre-existing locations via migration
Defensive patterns

Strategy: validation

Validate before calling

// Ensure volume detection ran before enabling change detection
let loc = entities::location::Entity::find()
    .filter(entities::location::Column::Uuid.eq(location_id))
    .one(&db).await?;
if let Some(l) = loc {
    if l.volume_id.is_none() {
        // run volume detection for this location first
    }
}

Try / catch

if let Err(e) = DatabaseAdapter::new(...).await {
    if e.to_string().contains("has no volume_id") {
        // schedule volume detection, then re-queue this job
    }
}

Prevention

When it happens

Trigger: Starting change detection on a freshly added location before the volume-detection step has executed; upgrading from a schema version where volume_id did not exist and no backfill ran; volume detection failed silently earlier.

Common situations: Race between location creation pipeline stages (create location → detect volume → index); older databases migrated without a volume_id backfill; pluggable volume detection that skipped an unsupported filesystem.

Related errors


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