influxdata/influxdb · error

failed to read encoded schema

Error message

failed to read encoded schema

What it means

Panicked during to_parquet_file when reading the Arrow schema back from the encoded Parquet metadata failed. The Parquet footer bytes could not be parsed into a valid schema, meaning the encoded metadata is corrupt, truncated, or produced by an incompatible parquet writer. This is a hard expect: the library assumes any file it just encoded has a readable schema.

Solutions

  1. Regenerate the Parquet file with to_parquet_file; the source batch was likely fine and the encoded metadata is corrupt
  2. Verify the parquet crate version used to write matches the reader (same dependency version)
  3. Check that the object store write completed fully (compare file_size_bytes to actual object length)
  4. If parsing externally-supplied files, use read_schema() with proper error handling instead of the expect path

Example fix

// before (library code)
let schema = decoded.read_schema().expect("failed to read encoded schema");
// after (caller-side validation before use)
let schema = decoded.read_schema().map_err(|e| { eprintln!("corrupt parquet footer: {e}"); e })?;
Defensive patterns

Strategy: try-catch

Validate before calling

let bytes = object_store.get(&path).await?.bytes().await?;
if bytes.len() < 8 { return Err(anyhow!("truncated parquet file")); }

Try / catch

let schema = decoded.read_schema().map_err(|e| Error::CorruptFooter { source: e })?;

Prevention

When it happens

Trigger: Calling to_parquet_file with metadata whose thrift-encoded footer is truncated/corrupt; passing a mutable handle whose encoded bytes were truncated at flush; a parquet crate version mismatch producing unparseable metadata.

Common situations: Partial writes to object storage (truncated files), hand-edited or post-processed Parquet files, version skew between the parquet crate that wrote and reads the footer.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/2b23a6052b304f43. Report an issue: GitHub.

Appendix: source

Thrown at core/parquet_file/src/metadata.rs:469

    {
        let decoded = metadata.decode().expect("invalid IOx metadata");
        trace!(
            ?partition_id,
            ?decoded,
            "DecodedIoxParquetMetaData decoded from its IoxParquetMetaData"
        );
        let row_count = decoded.row_count();
        if decoded.md.row_groups().is_empty() {
            debug!(
                ?partition_id,
                "Decoded IoxParquetMetaData has no row groups to provide useful statistics"
            );
        }

        // Derive the min/max timestamp from the Parquet column statistics.
        let schema = decoded
            .read_schema()
            .expect("failed to read encoded schema");
        let stats = decoded
            .read_statistics(&schema)
            .expect("invalid statistics");
        let columns: Vec<_> = stats.iter().map(|v| column_id_map(&v.name)).collect();

        // Extract the min/max timestamps.
        let TimestampRange {
            min: min_time,
            max: max_time,
        } = derive_min_max_time(stats);

        ParquetFileParams {
            namespace_id: self.namespace_id,
            table_id: self.table_id,
            partition_id,
            partition_hash_id,
            object_store_id: self.object_store_id,
            min_time,

View on GitHub (pinned to 06200ef96b)