{"record":{"id":"77ee2d2e8ee80b52","repo":"spacedriveapp/spacedrive","slug":"invalid-severity","errorCode":null,"errorMessage":"Invalid severity: {}","messagePattern":"Invalid severity: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/cli/src/domains/sync/mod.rs","lineNumber":452,"sourceCode":"\t\tif let Some(event_type) = SyncEventType::from_str(event_type_str) {\n\t\t\tquery = query.with_event_types(vec![event_type]);\n\t\t} else {\n\t\t\treturn Err(anyhow::anyhow!(\"Invalid event type: {}\", event_type_str));\n\t\t}\n\t}\n\n\t// Parse correlation ID filter\n\tif let Some(corr_id_str) = &args.correlation_id {\n\t\tlet corr_id = uuid::Uuid::parse_str(corr_id_str)?;\n\t\tquery = query.with_correlation_id(corr_id);\n\t}\n\n\t// Parse severity filter\n\tif let Some(severity_str) = &args.severity {\n\t\tif let Some(severity) = EventSeverity::from_str(severity_str) {\n\t\t\tquery = query.with_severities(vec![severity]);\n\t\t} else {\n\t\t\treturn Err(anyhow::anyhow!(\"Invalid severity: {}\", severity_str));\n\t\t}\n\t}\n\n\t// Call the API\n\tlet input = sd_core::ops::sync::get_event_log::GetSyncEventLogInput {\n\t\tstart_time: query.time_range.map(|(start, _)| start),\n\t\tend_time: query.time_range.map(|(_, end)| end),\n\t\tevent_types: query.event_types,\n\t\tcategories: query.categories,\n\t\tseverities: query.severities,\n\t\tpeer_id: query.peer_filter,\n\t\tmodel_type: query.model_type_filter,\n\t\tcorrelation_id: query.correlation_id,\n\t\tlimit: query.limit,\n\t\toffset: query.offset,\n\t\tinclude_remote_peers: if args.all_devices { Some(true) } else { None },\n\t};\n","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/cli/src/domains/sync/mod.rs#L434-L470","documentation":"'sd sync events export --severity <value>' fails when the value is not one of the four names accepted by EventSeverity::from_str (core/src/infra/sync/event_log/types.rs:274): debug, info, warning, error. The match is exact and case-sensitive despite the display code using colored output.","triggerScenarios":"Passing 'warn', 'ERROR', 'Info', 'fatal', or any string other than the exact lowercase names.","commonSituations":"Habitual use of log-level spellings from other ecosystems (warn, err, critical); uppercase values copied from log output.","solutions":["Use an exact lowercase value: --severity debug|info|warning|error","Drop the filter and post-filter the JSON output by the severity field to discover valid names"],"exampleFix":"# before\nsd sync events export --severity warn\n\n# after\nsd sync events export --severity warning","handlingStrategy":"validation","validationCode":"const VALID_SEVERITIES: &[&str] = &[\"debug\", \"info\", \"warning\", \"error\"];\n\nfn is_valid_severity(s: &str) -> bool {\n    VALID_SEVERITIES.contains(&s.to_ascii_lowercase().as_str())\n}","typeGuard":"fn as_severity(s: &str) -> Option<EventSeverity> {\n    EventSeverity::from_str(s.to_ascii_lowercase().as_str())\n}","tryCatchPattern":"let Some(severity) = EventSeverity::from_str(&severity_str.to_ascii_lowercase()) else {\n    return Err(anyhow!(\"Invalid severity: {}. Use debug, info, warning, or error\", severity_str));\n};\nquery = query.with_severities(vec![severity]);","preventionTips":["Accept common aliases (warn -> warning) at the CLI boundary before calling from_str","Use clap's PossibleValues/ValueEnum for the flag so invalid values are rejected at parse time","Lowercase input before validation"],"tags":["cli","sync","validation","enums"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}