{"record":{"id":"8162d2120c69f19d","repo":"spacedriveapp/spacedrive","slug":"invalid-severity-8162d2","errorCode":null,"errorMessage":"Invalid severity: {}","messagePattern":"Invalid severity: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/src/infra/sync/event_log/logger.rs","lineNumber":196,"sourceCode":"\t\tlet severity_str: String = row.try_get(\"\", \"severity\")?;\n\t\tlet summary: String = row.try_get(\"\", \"summary\")?;\n\t\tlet details_str: Option<String> = row.try_get(\"\", \"details\").ok();\n\t\tlet correlation_id_str: Option<String> = row.try_get(\"\", \"correlation_id\").ok();\n\t\tlet peer_device_id_str: Option<String> = row.try_get(\"\", \"peer_device_id\").ok();\n\t\tlet model_types_str: Option<String> = row.try_get(\"\", \"model_types\").ok();\n\t\tlet record_count: Option<i64> = row.try_get(\"\", \"record_count\").ok();\n\t\tlet duration_ms: Option<i64> = row.try_get(\"\", \"duration_ms\").ok();\n\n\t\tOk(SyncEventLog {\n\t\t\tid: Some(id),\n\t\t\ttimestamp: DateTime::parse_from_rfc3339(&timestamp_str)?.with_timezone(&Utc),\n\t\t\tdevice_id: Uuid::parse_str(&device_id_str)?,\n\t\t\tevent_type: SyncEventType::from_str(&event_type_str)\n\t\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Invalid event type: {}\", event_type_str))?,\n\t\t\tcategory: EventCategory::from_str(&category_str)\n\t\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Invalid category: {}\", category_str))?,\n\t\t\tseverity: EventSeverity::from_str(&severity_str)\n\t\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Invalid severity: {}\", severity_str))?,\n\t\t\tsummary,\n\t\t\tdetails: details_str\n\t\t\t\t.as_ref()\n\t\t\t\t.and_then(|s| serde_json::from_str(s).ok()),\n\t\t\tcorrelation_id: correlation_id_str\n\t\t\t\t.as_ref()\n\t\t\t\t.and_then(|s| Uuid::parse_str(s).ok()),\n\t\t\tpeer_device_id: peer_device_id_str\n\t\t\t\t.as_ref()\n\t\t\t\t.and_then(|s| Uuid::parse_str(s).ok()),\n\t\t\tmodel_types: model_types_str.map(|s| s.split(',').map(|t| t.to_string()).collect()),\n\t\t\trecord_count: record_count.map(|c| c as u64),\n\t\t\tduration_ms: duration_ms.map(|d| d as u64),\n\t\t})\n\t}\n\n\t/// Clean up old events (called by pruning task)\n\tpub async fn cleanup_old_events(&self, older_than: DateTime<Utc>) -> Result<usize> {","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/infra/sync/event_log/logger.rs#L178-L214","documentation":"Row mapper at core/src/infra/sync/event_log/logger.rs:196 parses sync_event_log.severity via EventSeverity::from_str, which accepts exactly: debug, info, warning, error. Any other severity string fails the row conversion and surfaces as this anyhow error when listing sync events.","triggerScenarios":"A sync_event_log row with severity 'warn', 'ERROR', 'critical', or an empty string — anything not the four exact lowercase tokens. Core writes only via EventSeverity::as_str(), so real triggers are external inserts, fixtures, or a modified enum on another build.","commonSituations":"Test fixtures using log-level spellings ('warn' from tracing/RUST_LOG); manual INSERTs; another daemon version with extra severity levels.","solutions":["Audit values: `SELECT DISTINCT severity FROM sync_event_log;`.","Normalize or delete offending rows: UPDATE sync_event_log SET severity='warning' WHERE severity='warn';","Fix fixtures/scripts to use EventSeverity::as_str() tokens; add legacy arms to from_str if you rename severities."],"exampleFix":"# before\nsqlite> SELECT DISTINCT severity FROM sync_event_log;\nwarn\n\n# after\nsqlite> UPDATE sync_event_log SET severity='warning' WHERE severity='warn';","handlingStrategy":"validation","validationCode":"// normalize before insert (e.g. adapting log-level spellings)\nfn severity_token(s: &str) -> Option<&'static str> {\n    match s.to_ascii_lowercase().as_str() {\n        \"warn\" | \"warning\" => Some(\"warning\"),\n        \"debug\" | \"info\" | \"error\" => Some(match s { \"debug\" => \"debug\", \"info\" => \"info\", _ => \"error\" }),\n        _ => None,\n    }\n}","typeGuard":"fn is_known_severity(s: &str) -> bool {\n    EventSeverity::from_str(s).is_some()\n}","tryCatchPattern":"// tolerate unknown severities at read time\nlet severity = match EventSeverity::from_str(&severity_str) {\n    Some(s) => s,\n    None => { tracing::warn!(severity = %severity_str, \"unknown severity\"); continue; }\n};","preventionTips":["Write severity with EventSeverity::as_str() only (debug/info/warning/error).","Do not reuse RUST_LOG level names ('warn', 'trace') in the column.","Extend from_str with aliases when severities evolve."],"tags":["sync","event-log","database","version-skew"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}