{"record":{"id":"5646a582ff248524","repo":"spacedriveapp/spacedrive","slug":"contentidentity-not-found","errorCode":null,"errorMessage":"ContentIdentity not found","messagePattern":"ContentIdentity not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/src/ops/media/ocr/processor.rs","lineNumber":95,"sourceCode":"\t\tdebug!(\"→ Extracting text via OCR for: {}\", entry.path.display());\n\n\t\t// Extract text\n\t\tlet extracted_text = super::extract_text_from_file(&entry.path, &self.languages).await?;\n\n\t\tif extracted_text.is_empty() {\n\t\t\tdebug!(\"No text extracted from: {}\", entry.path.display());\n\t\t\treturn Ok(ProcessorResult::success(0, 0));\n\t\t}\n\n\t\tdebug!(\"✓ Extracted {} characters of text\", extracted_text.len());\n\n\t\t// Update content_identity with extracted text\n\t\tuse crate::infra::db::entities::content_identity;\n\n\t\tlet ci = content_identity::Entity::find_by_id(content_id)\n\t\t\t.one(db)\n\t\t\t.await?\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"ContentIdentity not found\"))?;\n\n\t\tlet mut ci_active: content_identity::ActiveModel = ci.into();\n\t\tci_active.text_content = Set(Some(extracted_text.clone()));\n\n\t\tci_active.update(db).await?;\n\n\t\tdebug!(\"✓ Stored extracted text in content_identity\");\n\n\t\tOk(ProcessorResult::success(1, extracted_text.len() as u64))\n\t}\n\n\tpub fn name(&self) -> &'static str {\n\t\t\"ocr\"\n\t}\n}\n","sourceCodeStart":77,"sourceCodeEnd":111,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/ops/media/ocr/processor.rs#L77-L111","documentation":"After OCR extracts text, the processor loads the content_identity row by the entry's content_id to write text_content. This error means that row no longer exists: the content identity was deleted (or its entry re-identified and replaced) between when the processor was scheduled and when it ran.","triggerScenarios":"Entry deleted or re-indexed while the OCR job sat in queue, cascading deletion of content_identity; re-identification creating a new content row and removing the old one; manual DB cleanup.","commonSituations":"Long processor backlogs with active file deletion; reindex runs that rebuild content identities; multi-client libraries where another client purges content.","solutions":["Treat the missing row as a skip (ProcessorResult::success(0, 0) or a skipped status), not a hard error","Cancel queued OCR jobs when their entries are deleted or re-identified","Re-run identification then OCR if the file still exists"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm the identity row still exists before OCR\ncurrent = content_identity::Entity::find_by_id(content_id).one(db).await?;\nif current.is_none() { /* skip: entry was re-identified or deleted */ }","typeGuard":null,"tryCatchPattern":"match content_identity::Entity::find_by_id(content_id).one(db).await? {\n    Some(ci) => { /* proceed with update */ }\n    None => {\n        tracing::debug!(%content_id, \"content identity vanished; skipping OCR write\");\n        return Ok(ProcessorResult::success(0, 0));\n    }\n}","preventionTips":["Invalidate queued OCR work when entries are deleted or re-identified","Treat missing identity rows as skips, not failures","Keep processor backlogs short so scheduling state stays fresh"],"tags":["ocr","media-processors","content-identity","race-condition"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}