pola-rs/polars · error
failed to read the schema hashes from the file
Error message
failed to read the schema hashes from the file
What it means
Panics when reading dsl-schema-hashes.json fails during check-hashes, e.g. the file is missing or unreadable. The check-hashes command compares stored hashes against the current schema; this guard fires before comparison when the baseline file cannot be loaded.
Source
Thrown at crates/polars-plan/src/bin/dsl-schema.rs:95
let mut file = File::create(path).expect("failed to open the schema file for writing");
serde_json::to_writer_pretty(&mut file, &schema).expect("failed to serialize the schema");
writeln!(&mut file).expect("failed to write the last newline");
file.flush().expect("failed to flush the schema file");
}
/// Outputs the current DSL schema hashes into a file at the given path.
///
/// Any existing file at the path is overwritten.
fn update_hashes(path: impl AsRef<Path>) {
std::fs::write(path, current_schema_hashes())
.expect("failed to write the schema into the file");
eprintln!("the DSL schema file was updated");
}
/// Checks that the current schema hashes match the schema hashes in the file.
fn check_hashes(path: impl AsRef<Path>) {
let file_hashes =
std::fs::read_to_string(path).expect("failed to read the schema hashes from the file");
let expected = current_schema_hashes();
if file_hashes != expected {
eprintln!("the schema hashes are not up to date, run `make update-dsl-schema-hashes`");
eprintln!("expected schema hashes:");
eprintln!("{}", expected);
std::process::exit(1);
}
eprintln!("the DSL schema hashes are up to date");
}
/// Returns the schema hashes as a serialized JSON object.
/// Each field is named after a data type, with its schema hash as the value.
fn current_schema_hashes() -> String {
let schema = DslPlan::dsl_schema();
let mut hashes = serde_json::Map::new();View on GitHub (pinned to 9b5d73fd00)
Solutions
- Ensure the schema hashes file exists and is readable; regenerate it with the `generate` command if missing.
- Check file permissions on the hashes file.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: This panic/expect fires when execution reaches an unguarded state described by: "failed to read the schema hashes from the file". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.
Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("failed to read the schema hashes from the file"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/65955290adf1cc00.
Report an issue: GitHub.