{"record":{"id":"a731bb3151b30771","repo":"sxyazi/yazi","slug":"cannot-read-cache-stamp-e","errorCode":null,"errorMessage":"Cannot read cache stamp: {e}","messagePattern":"Cannot read cache stamp: (.+?)","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"yazi-vfs/src/stamp.rs","lineNumber":25,"sourceCode":"\nimpl Stamp {\n\tconst SIG_LEN: usize = 26;\n\n\tpub async fn read<U>(url: U) -> io::Result<Self>\n\twhere\n\t\tU: AsUrl,\n\t{\n\t\tlet path =\n\t\t\turl.as_url().stamp_entry().ok_or_else(|| io::Error::other(\"Cannot determine cache stamp\"))?;\n\n\t\tSelf::read_at(&path).await\n\t}\n\n\tasync fn read_at(path: &Path) -> io::Result<Self> {\n\t\tlet data = Local::regular(path)\n\t\t\t.read()\n\t\t\t.await\n\t\t\t.map_err(|e| io::Error::new(e.kind(), format!(\"Cannot read cache stamp: {e}\")))?;\n\n\t\tSelf::try_from(data)\n\t\t\t.map_err(|e| io::Error::new(e.kind(), format!(\"Cannot parse cache stamp: {e}\")))\n\t}\n\n\tpub async fn resolve<U, S>(dir: U, key: S) -> io::Result<UrlBuf>\n\twhere\n\t\tU: AsUrl,\n\t\tS: AsStrand,\n\t{\n\t\tlet dir = dir.as_url();\n\t\tlet key = key.as_strand();\n\n\t\tlet mut path =\n\t\t\tdir.auth().stamp_root().ok_or_else(|| io::Error::other(\"Cannot determine stamp root\"))?;\n\t\tpath.push(key.as_os()?);\n\n\t\tlet stamp = Self::read_at(&path).await?;","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/sxyazi/yazi/blob/8ebf930f1796ae2076b7d6b0c5e93a1002c18134/yazi-vfs/src/stamp.rs#L7-L43","documentation":"This io::Error wraps a failure while reading the cache stamp file at a given path via Local::regular().read(). The original OS error kind is preserved, and its Display is embedded as 'Cannot read cache stamp: {e}'. It means the stamp file itself could not be read (missing, permissions, I/O failure), not that its contents were bad.","triggerScenarios":"Calling Stamp::read_at (via Stamp::resolve or any consumer of the stamp cache) when the stamp file does not exist, lacks read permission, or the underlying file read fails asynchronously.","commonSituations":"Cache directory cleaned or partially deleted while Yazi is running; a downloaded entry's stamp file removed by a cleaner; permission changes on the cache directory; disk I/O errors.","solutions":["Recreate the cache entry (re-download / rewrite the stamp) instead of treating it as fatal — a missing stamp is usually recoverable","Check permissions and existence of the stamp file path before reading","Verify the cache directory is on a healthy, writable filesystem"],"exampleFix":"// before\nlet stamp = Stamp::resolve(dir, key).await?;\n// after\nlet stamp = match Stamp::resolve(dir, key).await {\n    Ok(s) => s,\n    Err(e) if e.kind() == io::ErrorKind::NotFound => re_download_and_write_stamp().await?,\n    Err(e) => return Err(e),\n};","handlingStrategy":"fallback","validationCode":"match tokio::fs::metadata(&stamp_path).await {\n    Ok(m) if m.is_file() => {},\n    _ => { /* treat as cache miss: re-download */ }\n}","typeGuard":"fn stamp_readable(path: &Path) -> bool {\n    std::fs::File::open(path).map(|_| true).unwrap_or(false)\n}","tryCatchPattern":"match Stamp::resolve(dir, key).await {\n    Ok(url) => url,\n    Err(e) if e.kind() == io::ErrorKind::NotFound || e.kind() == io::ErrorKind::PermissionDenied => cache_miss_fallback(),\n    Err(e) => return Err(e),\n}","preventionTips":["Treat any stamp read failure as a cache miss and regenerate rather than propagating","Do not delete cache files while Yazi is running","Keep the cache directory on a healthy writable volume"],"tags":["io","filesystem","cache","rust"],"backgroundTag":"cache-file-read-failed","analyzedSha":"8ebf930f1796ae2076b7d6b0c5e93a1002c18134","analyzedAt":"2026-09-02T18:38:25.566Z","contentChangedAt":"2026-09-02T18:38:25.566Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}