{"record":{"id":"392e1ff0881b700f","repo":"spacedriveapp/spacedrive","slug":"invalid-number","errorCode":null,"errorMessage":"Invalid number: {}","messagePattern":"Invalid number: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/cli/src/domains/sync/mod.rs","lineNumber":161,"sourceCode":"\t\t\t.map(|dt| dt.with_timezone(&Utc))\n\t\t\t.or_else(|_| {\n\t\t\t\t// Try common formats\n\t\t\t\tDateTime::parse_from_str(time_str, \"%Y-%m-%d %H:%M:%S\")\n\t\t\t\t\t.map(|dt| dt.with_timezone(&Utc))\n\t\t\t})\n\t\t\t.map_err(|_| anyhow::anyhow!(\"Invalid time format: {}\", time_str))\n\t}\n}\n\nfn parse_duration(duration_str: &str) -> Result<chrono::Duration> {\n\tlet parts: Vec<&str> = duration_str.split_whitespace().collect();\n\tif parts.len() != 2 {\n\t\treturn Err(anyhow::anyhow!(\"Invalid duration format: {}\", duration_str));\n\t}\n\n\tlet value: i64 = parts[0]\n\t\t.parse()\n\t\t.map_err(|_| anyhow::anyhow!(\"Invalid number: {}\", parts[0]))?;\n\tlet unit = parts[1].to_lowercase();\n\n\tlet seconds = match unit.as_str() {\n\t\t\"second\" | \"seconds\" | \"sec\" | \"s\" => value,\n\t\t\"minute\" | \"minutes\" | \"min\" | \"m\" => value * 60,\n\t\t\"hour\" | \"hours\" | \"h\" => value * 3600,\n\t\t\"day\" | \"days\" | \"d\" => value * 86400,\n\t\t\"week\" | \"weeks\" | \"w\" => value * 604800,\n\t\t_ => return Err(anyhow::anyhow!(\"Unknown time unit: {}\", unit)),\n\t};\n\n\tOk(chrono::Duration::seconds(seconds))\n}\n\nfn display_metrics(\n\tsnapshot: &sd_core::service::sync::metrics::snapshot::SyncMetricsSnapshot,\n\targs: &SyncMetricsArgs,\n) {","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/cli/src/domains/sync/mod.rs#L143-L179","documentation":"Thrown by parse_duration() when the first whitespace-separated token of a duration string cannot be parsed as i64. The parser expects '<integer> <unit>' (e.g. '30 minutes'), so any non-numeric first token (or a float like '1.5') fails at parts[0].parse::<i64>().","triggerScenarios":"--since 'half an hour ago' (first token 'half'), '--since \"1.5 hours ago\"' ('1.5' is not an i64), '--since \"-2 days ago\"' actually parses but note negatives pass through; '--since \"several days ago\"'.","commonSituations":"Natural-language quantities; decimal durations where fractional support was assumed; localized number formats like '1,5'.","solutions":["Use a whole number: --since '2 hours ago' instead of '1.5 hours ago'","Pick a smaller unit to approximate fractions: '90 minutes ago'","Avoid words as quantities; use absolute timestamps for precise values"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let first = duration_str.split_whitespace().next().unwrap_or(\"\");\nif first.parse::<i64>().is_err() {\n    eprintln!(\"Duration quantity must be a whole number, got '{}'\", first);\n    return Ok(());\n}","typeGuard":"fn quantity_is_integer(d: &str) -> bool {\n    d.split_whitespace().next().map(|t| t.parse::<i64>().is_ok()).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Use whole numbers only - '1.5 hours' fails; write '90 minutes'","Never use words as quantities ('half an hour')","For fractional precision, switch to an absolute timestamp"],"tags":["cli","sync","time-parsing","duration"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}