pola-rs/polars · error · ValueError

use of `how='outer_coalesce'` should be replaced with…

Error message

use of `how='outer_coalesce'` should be replaced with `how='full', coalesce=True`.

What it means

Deprecation/removal guard in LazyFrame.join for the legacy 'outer_coalesce' strategy. Coalescing join keys is now controlled by an explicit `coalesce` parameter rather than a separate how value, so how='outer_coalesce' is rejected with instructions to use how='full', coalesce=True instead.

Solutions

  1. Replace how='outer_coalesce' with how='full', coalesce=True
  2. Audit codebases for remaining 'outer'/'outer_coalesce' join strategies after upgrading Polars

Example fix

// before
df.join(other, on='id', how='outer_coalesce')
// after
df.join(other, on='id', how='full', coalesce=True)
Defensive patterns

Strategy: validation

Validate before calling

def normalize_how(how, coalesce=None):
    if how == 'outer_coalesce':
        return 'full', True
    if how == 'outer':
        return 'full', coalesce
    return how, coalesce

Type guard

def is_modern_strategy(how) -> bool:
    return how not in ('outer', 'outer_coalesce')

Try / catch

try:
    out = df.join(other, on='id', how=how)
except ValueError as e:
    if 'outer_coalesce' in str(e):
        out = df.join(other, on='id', how='full', coalesce=True)
    else:
        raise

Prevention

When it happens

Trigger: Calling lf.join(other, on='id', how='outer_coalesce') on a Polars version where this strategy alias was removed (post-1.0 rename of outer joins to full joins).

Common situations: Code written between the 'outer_coalesce' introduction and its removal, then run on a newer Polars; migration scripts updated only partially from 'outer' to 'outer_coalesce'.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/c5703b5894463540. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/lazyframe/frame.py:6233

        require_same_type(self, other)

        if maintain_order is None:
            maintain_order = "none"

        uses_on = on is not None
        uses_left_on = left_on is not None
        uses_right_on = right_on is not None
        uses_lr_on = uses_left_on or uses_right_on
        if uses_on and uses_lr_on:
            msg = "cannot use 'on' in conjunction with 'left_on' or 'right_on'"
            raise ValueError(msg)
        elif uses_left_on != uses_right_on:
            msg = "'left_on' requires corresponding 'right_on'"
            raise ValueError(msg)

        if how == "outer":  # type: ignore[comparison-overlap]
            msg = "use of `how='outer'` should be replaced with `how='full'`."
            raise ValueError(msg)
        elif how == "outer_coalesce":  # type: ignore[comparison-overlap]
            msg = "use of `how='outer_coalesce'` should be replaced with `how='full', coalesce=True`."
            raise ValueError(msg)
        elif how == "cross":
            if uses_on or uses_lr_on:
                msg = "cross join should not pass join keys"
                raise ValueError(msg)
            return self._from_pyldf(
                self._ldf.join(
                    other._ldf,
                    [],
                    [],
                    allow_parallel,
                    force_parallel,
                    nulls_equal,
                    how,
                    suffix,
                    validate,

View on GitHub (pinned to fe841f959e)