pola-rs/polars · error · ValueError
unrecognised deprecation type {tp!r}.\nExpected one (or more
Error message
unrecognised deprecation type {tp!r}.\nExpected one (or more) of {repr(sorted(valid_types))[1:-1]} What it means
Validation inside identify_deprecations: one of the strings in `types` is not a member of the DeprecationType literal ('function', 'renamed_parameter', 'nonkeyword_arguments', 'parameter_as_multi_positional', ...). The invalid type string is the faulty input.
Source
Thrown at py-polars/src/polars/_utils/deprecation.py:339
- "function"
- "renamed_parameter"
- "nonkeyword_arguments"
- "parameter_as_multi_positional"
Examples
--------
>>> from polars._utils.deprecation import identify_deprecations
>>> identify_deprecations("nonkeyword_arguments") # doctest: +IGNORE_RESULT
{'nonkeyword_arguments': ['functions.business.business_day_count']}
"""
valid_types = set(get_args(DeprecationType))
for tp in types:
if tp not in valid_types:
msg = (
f"unrecognised deprecation type {tp!r}.\n"
f"Expected one (or more) of {repr(sorted(valid_types))[1:-1]}"
)
raise ValueError(msg)
package_path = Path(sys.modules["polars"].__file__).parent # type: ignore[arg-type]
results = defaultdict(list)
for py_file in package_path.rglob("*.py"):
rel_path = py_file.relative_to(package_path)
module_path = ".".join(rel_path.parts).removesuffix(".py")
with py_file.open("r", encoding="utf-8") as src:
for deprecation_type, func_names in _find_deprecated_functions(
source=src.read(),
module_path=module_path,
).items():
if deprecation_type not in valid_types:
# note: raising here implies we have a new deprecation function
# that should be added to the DeprecationType type alias
msg = f"unrecognised deprecation type {tp!r}.\n"
raise ValueError(msg)
View on GitHub (pinned to 5d8ebabf11)
Solutions
- Use a valid deprecation type among the listed valid_types.
Example fix
deprecate(..., types=('param',)) Defensive patterns
Strategy: validation
When it happens
Trigger: Internal deprecation helper received an unknown deprecation type.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@5d8ebabf11 (2026-08-19).
Data as JSON: /api/errors/c39dc4b28cab39f0.
Report an issue: GitHub.