{"record":{"id":"4d4f559431c4b5c1","repo":"pola-rs/polars","slug":"the-argument-param-name-r-for-func-name-r-was-deprecated-and","errorCode":null,"errorMessage":"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}","messagePattern":"the argument (.+?) for (.+?)(.+?) has been removed in version (.+?)\\. It was renamed to (.+?)\\. (.+?)","errorType":"exception","errorClass":"ArgumentRemovedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/_utils/expired.py","lineNumber":151,"sourceCode":"        if param.deprecated_in is not None\n        else \"\"\n    )\n    if isinstance(param, RenamedParameter):\n        if param.name in kwargs and param.new_name in kwargs:\n            msg = (\n                f\"{func_name!r} received both {param.name!r} and {param.new_name!r} as arguments;\"\n                f\" {param.name!r}{was_deprecated_and} has been renamed to\"\n                f\" {param.new_name!r} in version {param.removed_in}.\"\n            )\n            raise ArgumentRemovedError(msg)\n        else:\n            msg = (\n                f\"the argument {param.name!r} for {func_name!r}{was_deprecated_and}\"\n                f\" has been removed in version {param.removed_in}.\"\n                f\" It was renamed to {param.new_name!r}.\"\n            )\n            msg = msg if param.hint is None else f\"{msg} {param.hint}\"\n            raise ArgumentRemovedError(msg)\n    elif isinstance(param, RemovedParameter):\n        msg = (\n            f\"the argument {param.name!r} for {func_name!r}{was_deprecated_and}\"\n            f\" has been removed in version {param.removed_in}.\"\n        )\n        msg = msg if param.hint is None else f\"{msg} {param.hint}\"\n        raise ArgumentRemovedError(msg)\n    else:\n        msg = f\"Unexpected parameter type: {type(param)!r}\"\n        raise TypeError(msg)\n","sourceCodeStart":133,"sourceCodeEnd":162,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/_utils/expired.py#L133-L162","documentation":"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.","triggerScenarios":"Calling a decorated Polars function using the pre-rename keyword, e.g. `func(old_name=5)` where the signature now expects `new_name=5`.","commonSituations":"Running code written against an older Polars version; tutorials/Stack Overflow snippets predating the rename; internal tooling that builds kwargs dynamically with legacy keys.","solutions":["Rename the keyword argument to the new name given in the error message","Apply the hint's suggested replacement if provided","Search the codebase for the old kwarg and update all occurrences"],"exampleFix":"// before\npl.read_csv(f, row_count_name=\"n\")\n// after\npl.read_csv(f, row_index_name=\"n\")","handlingStrategy":"try-catch","validationCode":"removed = {\"row_count_name\": \"row_index_name\"}  # old -> new\nkwargs = {removed.get(k, k): v for k, v in kwargs.items()}","typeGuard":null,"tryCatchPattern":"try:\n    result = func(**kwargs)\nexcept ArgumentRemovedError as e:\n    match = re.search(r\"renamed to '(\\w+)'\", str(e))\n    if match:\n        kwargs[match.group(1)] = kwargs.pop(old_name)\n        result = func(**kwargs)\n    else:\n        raise","preventionTips":["Upgrade code when deprecation warnings (not errors) still fire","Keep a mapping of old->new kwarg names for dynamic kwargs code","Test against the target polars version in CI before deploying"],"tags":["python","polars","removed-argument","renamed-parameter"],"backgroundTag":"deprecated-api-usage","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}