{"record":{"id":"3d65ebe71d800ff7","repo":"lsd-rs/lsd","slug":"failed-to-retrieve-modified-date","errorCode":null,"errorMessage":"failed to retrieve modified date","messagePattern":"failed to retrieve modified date","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/date.rs","lineNumber":29,"sourceCode":"pub enum Date {\n    Date(DateTime<Local>),\n    Invalid,\n}\n\n// Note that this is split from the From for Metadata so we can test this one (as we can't mock Metadata)\nimpl From<SystemTime> for Date {\n    fn from(systime: SystemTime) -> Self {\n        // FIXME: This should really involve a result, but there's upstream issues in chrono. See https://github.com/chronotope/chrono/issues/110\n        let res = panic::catch_unwind(|| systime.into());\n\n        res.map_or(Date::Invalid, Date::Date)\n    }\n}\n\nimpl From<&Metadata> for Date {\n    fn from(meta: &Metadata) -> Self {\n        meta.modified()\n            .expect(\"failed to retrieve modified date\")\n            .into()\n    }\n}\n\nimpl Date {\n    pub fn render(&self, colors: &Colors, flags: &Flags) -> ColoredString {\n        let date_string = self.date_string(flags);\n        let elem = match self {\n            Self::Date(modified) => Elem::Date(modified.timestamp()),\n            Self::Invalid => Elem::InvalidDate,\n        };\n\n        colors.colorize(date_string, &elem)\n    }\n    fn date_string(&self, flags: &Flags) -> String {\n        let locale = current_locale();\n\n        if let Date::Date(val) = self {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/lsd-rs/lsd/blob/4b6c14a110fe0fd544ec0204501b5fd3a5d6218f/src/meta/date.rs#L11-L47","documentation":"Date::from(&Metadata) calls Metadata::modified() and .expect()s it to succeed. On platforms/filesystems where the modification time is unavailable (std returns io::Error), this panic aborts eza instead of rendering the date column. The library assumes mtime always exists, which is not guaranteed on exotic filesystems.","triggerScenarios":"Listing files whose filesystem cannot supply a modified time — Metadata::modified() returns Err — while eza renders metadata (from() invoked during date column rendering).","commonSituations":"Files on network filesystems (NFS/SMB), FUSE mounts, some procfs/sysfs virtual files, or Windows FAT volumes with missing timestamps; files created/modified by the OS in ways that leave mtime unset.","solutions":["Identify the file triggering it and check its filesystem (stat <file>); copy/move the file to a filesystem that supports mtime.","If you build eza, replace the expect with graceful degradation: use meta.modified().ok().map(Into::into).unwrap_or_default() and render a placeholder.","Update/upgrade the FUSE or network filesystem driver so it reports timestamps.","Work around by excluding the offending mount from the listing (e.g. list a different directory, adjust ignore globs)."],"exampleFix":"// before\nmeta.modified().expect(\"failed to retrieve modified date\").into()\n// after\nmatch meta.modified() {\n    Ok(mtime) => mtime.into(),\n    Err(_) => SystemTime::UNIX_EPOCH.into(), // or skip the date column\n}","handlingStrategy":"try-catch","validationCode":"match std::fs::metadata(path) {\n    Ok(meta) => match meta.modified() {\n        Ok(_) => { /* safe to list */ },\n        Err(e) => eprintln!(\"no mtime for {}: {}\", path.display(), e),\n    },\n    Err(e) => eprintln!(\"stat failed: {}\", e),\n}","typeGuard":"fn has_mtime(meta: &std::fs::Metadata) -> bool {\n    meta.modified().is_ok()\n}","tryCatchPattern":"let date = std::panic::catch_unwind(|| Date::from(&meta))\n    .unwrap_or_else(|_| Date::from(std::time::SystemTime::UNIX_EPOCH));\n// or, if patching the library: meta.modified().ok().map(Into::into).unwrap_or_default()","preventionTips":["Avoid listing files on filesystems known to omit timestamps (some FUSE, procfs, FAT).","Test eza against network/FUSE mounts before scripting bulk listings.","Patch to use meta.modified().ok() with a placeholder instead of expect().","Keep filesystem drivers updated so stat/mtime syscalls succeed."],"tags":["filesystem","panic","metadata","timestamps"],"backgroundTag":"metadata-unavailable","analyzedSha":"4b6c14a110fe0fd544ec0204501b5fd3a5d6218f","analyzedAt":"2026-09-04T20:04:26.847Z","contentChangedAt":"2026-09-04T20:04:26.847Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}