{"record":{"id":"1a881a55371cee95","repo":"spacedriveapp/spacedrive","slug":"failed-to-dispatch-thumbnail-job","errorCode":null,"errorMessage":"Failed to dispatch thumbnail job: {}","messagePattern":"Failed to dispatch thumbnail job: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"core/src/service/sidecar_manager.rs","lineNumber":319,"sourceCode":"\t\t\t\t\tThumbnailJob, ThumbnailJobConfig, ThumbnailVariants,\n\t\t\t\t};\n\t\t\t\tuse sea_orm::{ColumnTrait, EntityTrait, QueryFilter};\n\n\t\t\t\t// Find an entry with this content_uuid\n\t\t\t\tlet entry_with_content = entry::Entity::find()\n\t\t\t\t\t.find_also_related(content_identity::Entity)\n\t\t\t\t\t.filter(content_identity::Column::Uuid.eq(*content_uuid))\n\t\t\t\t\t.one(db.conn())\n\t\t\t\t\t.await?;\n\n\t\t\t\tif let Some((entry_model, _)) = entry_with_content {\n\t\t\t\t\tif let Some(entry_uuid) = entry_model.uuid {\n\t\t\t\t\t\t// Dispatch thumbnail job for this specific entry\n\t\t\t\t\t\tlet config = ThumbnailJobConfig::default();\n\t\t\t\t\t\tlet job = ThumbnailJob::for_entries(vec![entry_uuid], config);\n\n\t\t\t\t\t\tlibrary.jobs().dispatch(job).await.map_err(|e| {\n\t\t\t\t\t\t\tanyhow::anyhow!(\"Failed to dispatch thumbnail job: {}\", e)\n\t\t\t\t\t\t})?;\n\n\t\t\t\t\t\tinfo!(\n\t\t\t\t\t\t\t\"Dispatched thumbnail job for {} {} {} (content: {})\",\n\t\t\t\t\t\t\tkind.as_str(),\n\t\t\t\t\t\t\tvariant.as_str(),\n\t\t\t\t\t\t\tformat.as_str(),\n\t\t\t\t\t\t\tcontent_uuid\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t_ => {\n\t\t\t\t// For other sidecar types, just log for now\n\t\t\t\t// TODO: Implement dispatch for OCR, transcripts, etc.\n\t\t\t\tinfo!(\n\t\t\t\t\t\"Enqueued sidecar generation: {} {} {} for {} (no job dispatch yet)\",\n\t\t\t\t\tkind.as_str(),","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/service/sidecar_manager.rs#L301-L337","documentation":"library.jobs().dispatch(job) failed while dispatching a ThumbnailJob after a sidecar was stored. The job system for that library rejected the dispatch, most commonly because the jobs actor or its channel is already closed (library shutting down) or the job manager was never started. Thumbnails are regenerable, so failing the sidecar store on this is disproportionate.","triggerScenarios":"Library closing while sidecar writes trigger thumbnail dispatches; using a library handle whose job actor stopped after a restart; the dispatch channel already closed.","commonSituations":"Shutdown races at library close; background jobs racing daemon restarts.","solutions":["Log and continue: the thumbnail can be regenerated on the next scan or explicit request","Ensure the library's job system is running before sidecar-triggered dispatches","On shutdown, drain or cancel pending dispatches before closing the job channel"],"exampleFix":"// before\nlibrary.jobs().dispatch(job).await.map_err(|e| anyhow::anyhow!(\"Failed to dispatch thumbnail job: {}\", e))?;\n\n// after\nif let Err(e) = library.jobs().dispatch(job).await {\n    warn!(error = %e, \"thumbnail dispatch failed, will regenerate on next scan\");\n}","handlingStrategy":"fallback","validationCode":"// Only dispatch when the job system is live\nif library.jobs().is_running().await {\n    library.jobs().dispatch(job).await?;\n} else {\n    warn!(\"job system not running, thumbnail deferred\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = library.jobs().dispatch(job).await {\n    if e.to_string().contains(\"Failed to dispatch thumbnail job\") || e.to_string().contains(\"closed\") {\n        warn!(error = %e, \"thumbnail dispatch failed, will regenerate on next scan\");\n    } else {\n        return Err(e.into());\n    }\n}","preventionTips":["Treat thumbnail dispatch as best-effort: log and continue, thumbnails are regenerable","Ensure the library job system is running before sidecar-triggered dispatches","Drain or cancel pending dispatches before closing the job channel at shutdown"],"tags":["jobs","thumbnails","sidecar","shutdown"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}