pola-rs/polars · error · ArgumentRemovedError

the argument for has been removed in version . It was…

Error message

the argument {param.name!r} for {func_name!r}{was_deprecated_and} has been removed in version {param.removed_in}. It was renamed to {param.new_name!r}. {param.hint}

What it means

For a RenamedParameter whose old name is used (and the new name is absent), `wrapper` calls `_raise_removed_argument_error`, which raises ArgumentRemovedError explaining that the argument was removed in the given version, renamed to the new name, plus an optional hint.

Solutions

  1. Rename the keyword argument to the new name given in the error message
  2. Apply the hint's suggested replacement if provided
  3. Search the codebase for the old kwarg and update all occurrences

Example fix

// before
pl.read_csv(f, row_count_name="n")
// after
pl.read_csv(f, row_index_name="n")
Defensive patterns

Strategy: try-catch

Validate before calling

removed = {"row_count_name": "row_index_name"}  # old -> new
kwargs = {removed.get(k, k): v for k, v in kwargs.items()}

Try / catch

try:
    result = func(**kwargs)
except ArgumentRemovedError as e:
    match = re.search(r"renamed to '(\w+)'", str(e))
    if match:
        kwargs[match.group(1)] = kwargs.pop(old_name)
        result = func(**kwargs)
    else:
        raise

Prevention

When it happens

Trigger: Calling a decorated Polars function using the pre-rename keyword, e.g. `func(old_name=5)` where the signature now expects `new_name=5`.

Common situations: Running code written against an older Polars version; tutorials/Stack Overflow snippets predating the rename; internal tooling that builds kwargs dynamically with legacy keys.

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/4d4f559431c4b5c1. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/_utils/expired.py:151

        if param.deprecated_in is not None
        else ""
    )
    if isinstance(param, RenamedParameter):
        if param.name in kwargs and param.new_name in kwargs:
            msg = (
                f"{func_name!r} received both {param.name!r} and {param.new_name!r} as arguments;"
                f" {param.name!r}{was_deprecated_and} has been renamed to"
                f" {param.new_name!r} in version {param.removed_in}."
            )
            raise ArgumentRemovedError(msg)
        else:
            msg = (
                f"the argument {param.name!r} for {func_name!r}{was_deprecated_and}"
                f" has been removed in version {param.removed_in}."
                f" It was renamed to {param.new_name!r}."
            )
            msg = msg if param.hint is None else f"{msg} {param.hint}"
            raise ArgumentRemovedError(msg)
    elif isinstance(param, RemovedParameter):
        msg = (
            f"the argument {param.name!r} for {func_name!r}{was_deprecated_and}"
            f" has been removed in version {param.removed_in}."
        )
        msg = msg if param.hint is None else f"{msg} {param.hint}"
        raise ArgumentRemovedError(msg)
    else:
        msg = f"Unexpected parameter type: {type(param)!r}"
        raise TypeError(msg)

View on GitHub (pinned to fe841f959e)