{"record":{"id":"c0afe0cd7f252707","repo":"can1357/oh-my-pi","slug":"missing-name","errorCode":null,"errorMessage":"missing {name}","messagePattern":"missing (.+?)","errorType":"validation","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/pi-builtins/src/fd.rs","lineNumber":1413,"sourceCode":"\t\t|| minute > 59\n\t\t|| second > 59\n\t{\n\t\treturn Err(io::Error::new(io::ErrorKind::InvalidInput, format!(\"invalid date: {value}\")));\n\t}\n\tlet days = days_from_civil(year, month, day);\n\tlet seconds = days\n\t\t.checked_mul(86_400)\n\t\t.and_then(|base| base.checked_add(i64::from(hour * 3_600 + minute * 60 + second)))\n\t\t.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, \"date is out of range\"))?;\n\tif seconds < 0 {\n\t\treturn Err(io::Error::new(io::ErrorKind::InvalidInput, \"dates before 1970 are unsupported\"));\n\t}\n\tOk(UNIX_EPOCH + Duration::from_secs(u64::try_from(seconds).unwrap_or(u64::MAX)))\n}\n\nfn parse_i32_part(value: Option<&str>, name: &str) -> io::Result<i32> {\n\tvalue\n\t\t.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, format!(\"missing {name}\")))?\n\t\t.parse::<i32>()\n\t\t.map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err.to_string()))\n}\n\nfn parse_u32_part(value: Option<&str>, name: &str) -> io::Result<u32> {\n\tvalue\n\t\t.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, format!(\"missing {name}\")))?\n\t\t.parse::<u32>()\n\t\t.map_err(|err| io::Error::new(io::ErrorKind::InvalidInput, err.to_string()))\n}\n\nfn days_from_civil(year: i32, month: u32, day: u32) -> i64 {\n\tlet year = year - i32::from(month <= 2);\n\tlet era = if year >= 0 { year } else { year - 399 } / 400;\n\tlet year_of_era = year - era * 400;\n\tlet month = i32::try_from(month).unwrap_or(0);\n\tlet day = i32::try_from(day).unwrap_or(0);\n\tlet day_of_year = (153 * (month + if month > 2 { -3 } else { 9 }) + 2) / 5 + day - 1;","sourceCodeStart":1395,"sourceCodeEnd":1431,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-builtins/src/fd.rs#L1395-L1431","documentation":"parse_i32_part extracts a signed 32-bit date component (e.g. year) from an Option<&str> produced by splitting a date string. When the expected component is absent (None), it throws InvalidInput with 'missing {name}' where name identifies which part (year, etc.) was expected. It also converts any parse failure of the present string into an InvalidInput error.","triggerScenarios":"Passing a date string to the fd builtin that lacks a required numeric component, e.g. omitting the year in a date filter so the split yields fewer parts than the parser expects, causing parse_i32_part to receive None for that field.","commonSituations":"Malformed CLI date arguments like '--newer 12-25' (missing year), locale-dependent date formats with omitted fields, empty date strings after trimming.","solutions":["Supply the full date including the year, e.g. '1997-12-25'","Check the expected date format documented for the fd builtin's filter option","Quote the argument in your shell so dashes/hyphens are not misinterpreted"],"exampleFix":"// before\nfd --newer '12-25' .\n// after\nfd --newer '1997-12-25' .","handlingStrategy":"validation","validationCode":"fn validate_date_has_year(date: &str) -> Result<(), String> {\n\tlet parts: Vec<&str> = date.split('-').collect();\n\tif parts.len() < 3 {\n\t\treturn Err(format!(\"expected YYYY-MM-DD, got '{date}'\"));\n\t}\n\tOk(())\n}","typeGuard":null,"tryCatchPattern":"match builtin_result {\n\tErr(e) if e.to_string().starts_with(\"missing \") => eprintln!(\"date argument incomplete: {e}\"),\n\tErr(e) => return Err(e),\n\tOk(v) => /* ... */,\n}","preventionTips":["Always pass full ISO-style dates (YYYY-MM-DD) to the builtin","Never split or reformat dates with ad-hoc shell string cuts before passing them","Document the required date format in scripts that accept user input"],"tags":["rust","io","date-parsing","missing-argument"],"backgroundTag":"missing-date-component","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}