{"record":{"id":"8096568bdacc4c15","repo":"spacedriveapp/spacedrive","slug":"location-not-found","errorCode":null,"errorMessage":"Location not found: {}","messagePattern":"Location not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/src/ops/indexing/change_detection/persistent.rs","lineNumber":60,"sourceCode":"\tpub async fn new(\n\t\tcontext: Arc<CoreContext>,\n\t\tlibrary_id: Uuid,\n\t\tlocation_id: Uuid,\n\t\t_location_root: &Path,\n\t\tvolume_backend: Option<Arc<dyn crate::volume::VolumeBackend>>,\n\t) -> Result<Self> {\n\t\tlet library = context\n\t\t\t.get_library(library_id)\n\t\t\t.await\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Library not found: {}\", library_id))?;\n\n\t\tlet db = library.db().conn().clone();\n\n\t\tlet location_record = entities::location::Entity::find()\n\t\t\t.filter(entities::location::Column::Uuid.eq(location_id))\n\t\t\t.one(&db)\n\t\t\t.await?\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Location not found: {}\", location_id))?;\n\n\t\tlet location_root_entry_id = location_record\n\t\t\t.entry_id\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Location {} has no root entry\", location_id))?;\n\n\t\tlet volume_id = location_record.volume_id.ok_or_else(|| {\n\t\t\tanyhow::anyhow!(\n\t\t\t\t\"Location {} has no volume_id - volume must be detected before change detection\",\n\t\t\t\tlocation_id\n\t\t\t)\n\t\t})?;\n\n\t\tOk(Self {\n\t\t\tcontext,\n\t\t\tlibrary_id,\n\t\t\tlocation_id,\n\t\t\tlocation_root_entry_id,\n\t\t\tvolume_id,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/ops/indexing/change_detection/persistent.rs#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"Location removed via UI/CLI concurrently with an indexer start; copying ids between environments; partial location deletion that removed the row before cancelling jobs.","solutions":["Verify the location exists in the same library's DB before starting change detection","Cancel any pending indexing jobs when a location is deleted (deletion should invalidate queued jobs)","Confirm the location_id UUID is the one stored in entities::location (not the internal integer id)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the location row exists in this library's DB first\nlet found = entities::location::Entity::find()\n    .filter(entities::location::Column::Uuid.eq(location_id))\n    .one(&library.db().conn())\n    .await?;\nif found.is_none() {\n    tracing::warn!(%location_id, \"location missing; skipping change detection\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match DatabaseAdapter::new(...).await {\n    Ok(adapter) => adapter,\n    Err(e) if e.to_string().contains(\"Location not found\") => {\n        return Ok(()); // location deleted; job is obsolete\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate location_id belongs to the same library before scheduling jobs","Cancel queued indexing jobs during location deletion","Log library_id/location_id pairs at job enqueue time to debug mismatches"],"tags":["indexing","database","location","lifecycle","change-detection"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}