nautechsystems/nautilus_trader · error · anyhow::Error
Intervals are not disjoint after resetting file names
Error message
Intervals are not disjoint after resetting file names
What it means
Raised by reset_file_names after it renames all files in a directory based on their intervals. After renaming, it re-reads the directory intervals and verifies they are disjoint (no overlapping timestamp ranges). If files overlap, the rename operation would produce an inconsistent catalog, so it fails with this invariant violation.
Source
Thrown at crates/persistence/src/backend/catalog_operations.rs:1657
self.object_store.clone(),
&object_path,
"ts_init",
)
.await
})?;
let new_filename =
timestamps_to_filename(UnixNanos::from(first_ts), UnixNanos::from(last_ts));
let new_file_path = make_object_store_path(directory, &[&new_filename]);
let new_object_path = ObjectPath::from(new_file_path);
self.move_file(&object_path, &new_object_path)?;
}
let intervals = self.get_directory_intervals(directory)?;
if !are_intervals_disjoint(&intervals) {
anyhow::bail!("Intervals are not disjoint after resetting file names");
}
Ok(())
}
/// Finds all leaf data directories in the catalog.
///
/// A leaf directory is one that contains data files but no subdirectories.
/// This method is used to identify directories that can be processed for
/// consolidation or other operations.
///
/// # Returns
///
/// Returns a vector of directory path strings representing leaf directories,
/// or an error if directory traversal fails.
///
/// # Errors
///View on GitHub (pinned to 18893faf8b)
Solutions
- Inspect the directory intervals and remove or re-ingest the overlapping files before resetting names.
- Run consolidation (consolidate_data_by_period_generic) to merge overlapping files into coherent intervals.
- Restore the catalog from a known-good backup if the overlap is due to corruption.
- Identify the writer that produced overlapping files and fix session/time-window bookkeeping before re-running reset.
Defensive patterns
Strategy: validation
Validate before calling
let intervals = catalog.get_directory_intervals(&directory)?;
if !are_intervals_disjoint(&intervals) {
// consolidate or de-duplicate before resetting names
eprintln!("directory has overlapping intervals; consolidate first");
} Try / catch
if let Err(e) = catalog.reset_all_file_names() {
if e.to_string().contains("Intervals are not disjoint") {
// inspect overlapping files and consolidate/remove them, then retry
}
} Prevention
- Avoid running multiple writers against the same catalog directory concurrently.
- Run consolidation after merging catalogs or restoring partial backups.
- Audit interval overlap periodically on catalogs assembled from multiple sources.
When it happens
Trigger: Calling reset_all_file_names or reset_data_file_names on a catalog directory whose files contain overlapping timestamp ranges (e.g. duplicate/overlapping writes, files appended outside normal write paths, or a corrupted catalog).
Common situations: Catalogs assembled from multiple ingestion runs that wrote overlapping windows, concurrent writers without proper session isolation, or manually restored/merged backup files.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Intervals are not contiguous. When ensure_contiguous_files=t
- Replacement hash {transaction_hash} conflicts with another i
- Included wrap transaction {tx_hash} has invalid block number
- WETH balance overflow for included transaction {tx_hash} at
- Outcome side token '{fee_token}' carried a non-zero fee {fee
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/4ce7be3c382690f6.
Report an issue: GitHub.