spacedriveapp/spacedrive · error

ContentIdentity not found

Error message

ContentIdentity not found

What it means

The scrubbing-proxy processor resolves content_uuid via content_identity before generating proxies: it queries by entry.content_id and errors when no row matches. Unlike the no-content_id case (which returns a ProcessorResult::failure), this path hard-errors, failing the processor run when the identity row vanished after scheduling.

Source

Thrown at core/src/ops/media/proxy/processor.rs:117

	pub async fn process(
		&self,
		db: &sea_orm::DatabaseConnection,
		entry: &ProcessorEntry,
	) -> Result<ProcessorResult> {
		if !self.enabled {
			return Ok(ProcessorResult::success(0, 0));
		}

		// Get content UUID
		let content_uuid = if let Some(content_id) = entry.content_id {
			use crate::infra::db::entities::content_identity;
			use sea_orm::{ColumnTrait, EntityTrait, QueryFilter};

			let ci = content_identity::Entity::find()
				.filter(content_identity::Column::Id.eq(content_id))
				.one(db)
				.await?
				.ok_or_else(|| anyhow::anyhow!("ContentIdentity not found"))?;

			ci.uuid
				.ok_or_else(|| anyhow::anyhow!("ContentIdentity missing UUID"))?
		} else {
			return Ok(ProcessorResult::failure(
				"Entry has no content_id".to_string(),
			));
		};

		debug!("→ Generating scrubbing proxy for: {}", entry.path.display());

		// Call shared generation function
		let count = super::generate_proxy_for_file(
			&self.library,
			&content_uuid,
			&entry.path,
			&[self.variant.clone()],
			self.use_hardware_accel,

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Return ProcessorResult::failure/skip for a missing identity, matching the sibling no-content_id branch
  2. Invalidate queued proxy jobs on entry delete or re-identification
  3. Verify the entry still exists and its content_id still resolves before dequeuing work

Example fix

// before
let ci = content_identity::Entity::find()
    .filter(content_identity::Column::Id.eq(content_id))
    .one(db)
    .await?
    .ok_or_else(|| anyhow::anyhow!("ContentIdentity not found"))?;

// after: mirror the graceful sibling branch for vanished rows
let Some(ci) = content_identity::Entity::find()
    .filter(content_identity::Column::Id.eq(content_id))
    .one(db)
    .await?
else {
    return Ok(ProcessorResult::failure("ContentIdentity no longer exists".to_string()));
};
Defensive patterns

Strategy: try-catch

Validate before calling

// Resolve the identity before dequeuing proxy work
let ci = content_identity::Entity::find()
    .filter(content_identity::Column::Id.eq(entry.content_id.unwrap()))
    .one(db).await?;
if ci.is_none() { /* skip: nothing to key the proxy against */ }

Try / catch

match content_identity::Entity::find().filter(content_identity::Column::Id.eq(content_id)).one(db).await? {
    Some(ci) => ci,
    None => return Ok(ProcessorResult::failure("ContentIdentity no longer exists".into())),
}

Prevention

When it happens

Trigger: Entry deleted or re-identified between processor scheduling and execution, cascading to content_identity; queue backlog crossing a reindex that replaced content rows.

Common situations: Users deleting freshly-added media while proxy generation is queued; reindex rebuilding identities; database restores under a live job queue.

Related errors


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