getzola/zola · error
get file time
Error message
get file time
What it means
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.
Source
Thrown at components/templates/src/functions/load_data.rs:157
) -> u64 {
let mut hasher = DefaultHasher::new();
format.hash(&mut hasher);
method.hash(&mut hasher);
post_body.hash(&mut hasher);
post_content_type.hash(&mut hasher);
headers.hash(&mut hasher);
self.hash(&mut hasher);
hasher.finish()
}
}
impl Hash for DataSource {
fn hash<H: Hasher>(&self, state: &mut H) {
match self {
DataSource::Url(url) => url.hash(state),
DataSource::Path(path) => {
path.hash(state);
get_file_time(path).expect("get file time").hash(state);
}
// TODO: double check expectations here
DataSource::Literal(string_literal) => string_literal.hash(state),
};
}
}
fn get_output_format_from_args(
format_arg: Option<String>,
data_source: &DataSource,
) -> TeraResult<OutputFormat> {
if let Some(format) = format_arg {
return OutputFormat::from_str(&format);
}
if let DataSource::Path(path) = data_source {
match path.extension().and_then(|e| e.to_str()) {
Some(ext) => OutputFormat::from_str(ext).or(Ok(OutputFormat::Plain)),View on GitHub (pinned to 61d3082821)
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.
Example fix
// before let d = load_data(path = "data/missing.toml"); // after // ensure data/missing.toml exists (or check first): // ls data/missing.toml -> create or fix the path let d = load_data(path = "data/posts.toml");
Defensive patterns
Strategy: validation
Validate before calling
// Verify the data file is stat-able before load_data
let p = std::path::Path::new("data/posts.toml");
if p.metadata().is_err() {
eprintln!("load_data target missing or unreadable: {:?}", p);
} Type guard
fn file_stat_ok(path: &Path) -> bool {
std::fs::metadata(path).map(|m| m.is_file()).unwrap_or(false)
} Try / catch
match std::panic::catch_unwind(|| data.hash(&mut hasher)) {
Ok(_) => {},
Err(_) => anyhow::bail!("data file missing/unreadable for load_data cache key"),
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Could not read `{}` because of error: {}
- `{}` is not an empty folder (hidden files are ignored).
- Image output path '{:?}' should contain a parent directory,
- Can't watch `{entry}`: OS file watch limit reached. Check ho
- Can't watch `{entry}` for changes in folder `{}`. Does it ex
AI-assisted analysis of getzola/zola@61d3082821 (2026-09-03).
Data as JSON: /api/errors/d097e95404b1abe8.
Report an issue: GitHub.