{"record":{"id":"d097e95404b1abe8","repo":"getzola/zola","slug":"get-file-time","errorCode":null,"errorMessage":"get file time","messagePattern":"get file time","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"components/templates/src/functions/load_data.rs","lineNumber":157,"sourceCode":"    ) -> u64 {\n        let mut hasher = DefaultHasher::new();\n        format.hash(&mut hasher);\n        method.hash(&mut hasher);\n        post_body.hash(&mut hasher);\n        post_content_type.hash(&mut hasher);\n        headers.hash(&mut hasher);\n        self.hash(&mut hasher);\n        hasher.finish()\n    }\n}\n\nimpl Hash for DataSource {\n    fn hash<H: Hasher>(&self, state: &mut H) {\n        match self {\n            DataSource::Url(url) => url.hash(state),\n            DataSource::Path(path) => {\n                path.hash(state);\n                get_file_time(path).expect(\"get file time\").hash(state);\n            }\n            // TODO: double check expectations here\n            DataSource::Literal(string_literal) => string_literal.hash(state),\n        };\n    }\n}\n\nfn get_output_format_from_args(\n    format_arg: Option<String>,\n    data_source: &DataSource,\n) -> TeraResult<OutputFormat> {\n    if let Some(format) = format_arg {\n        return OutputFormat::from_str(&format);\n    }\n\n    if let DataSource::Path(path) = data_source {\n        match path.extension().and_then(|e| e.to_str()) {\n            Some(ext) => OutputFormat::from_str(ext).or(Ok(OutputFormat::Plain)),","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/getzola/zola/blob/61d30828217957120309db657950224edf9707e2/components/templates/src/functions/load_data.rs#L139-L175","documentation":"When hashing a DataSource::Path for the load_data cache key, hash calls get_file_time(path) to include the file's modified time, and panics with 'get file time' if that fails. get_file_time fails when the path doesn't exist, isn't readable, or its metadata can't be retrieved — so a load_data(path=...) pointing at a missing/unreadable file aborts here.","triggerScenarios":"Calling load_data with a path argument whose file cannot be stat'ed during cache-key computation: nonexistent path, permission-denied, or a path that is a broken symlink.","commonSituations":"Typo in the data file path; data file deleted/moved between renders; load_data executed inside Docker/CI where the data file wasn't copied; permission issues on mounted volumes.","solutions":["Verify the file exists at the given path relative to the site root/content dir and check for typos.","Check file permissions and that the file isn't a broken symlink.","Ensure the data file is included in the build environment (volume mount, COPY in Docker).","Use a literal or URL data source, or guard the path's existence before load_data."],"exampleFix":"// before\nlet d = load_data(path = \"data/missing.toml\");\n// after\n// ensure data/missing.toml exists (or check first):\n// ls data/missing.toml  -> create or fix the path\nlet d = load_data(path = \"data/posts.toml\");","handlingStrategy":"validation","validationCode":"// Verify the data file is stat-able before load_data\nlet p = std::path::Path::new(\"data/posts.toml\");\nif p.metadata().is_err() {\n    eprintln!(\"load_data target missing or unreadable: {:?}\", p);\n}","typeGuard":"fn file_stat_ok(path: &Path) -> bool {\n    std::fs::metadata(path).map(|m| m.is_file()).unwrap_or(false)\n}","tryCatchPattern":"match std::panic::catch_unwind(|| data.hash(&mut hasher)) {\n    Ok(_) => {},\n    Err(_) => anyhow::bail!(\"data file missing/unreadable for load_data cache key\"),\n}","preventionTips":["Check data file paths for typos and that files exist relative to the site root.","Include data files in Docker images / CI workspaces and mounted volumes.","Avoid broken symlinks as data sources.","Watch output directories: deleted data files break load_data cache-key hashing."],"tags":["filesystem","load-data","file-not-found","cache"],"backgroundTag":"file-not-found","analyzedSha":"61d30828217957120309db657950224edf9707e2","analyzedAt":"2026-09-03T14:39:09.727Z","contentChangedAt":"2026-09-03T14:39:09.727Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}