diff --git a/crates/polars-plan/src/logical_plan/mod.rs b/crates/polars-plan/src/logical_plan/mod.rs index d394327e41f43..045cd086ad792 100644 --- a/crates/polars-plan/src/logical_plan/mod.rs +++ b/crates/polars-plan/src/logical_plan/mod.rs @@ -79,7 +79,12 @@ impl std::fmt::Display for ErrorState { match self { ErrorState::NotYetEncountered { err } => write!(f, "NotYetEncountered({err})")?, ErrorState::AlreadyEncountered { prev_err_msg } => { - write!(f, "AlreadyEncountered({prev_err_msg})")? + if prev_err_msg.contains("AlreadyEncountered") { + // Recurively formatting error messages leads to N! memory usage + write!(f, "Multiple AlreadyEncountered")? + } else { + write!(f, "AlreadyEncountered({prev_err_msg})")? + } }, };