pola-rs/polars · error · ValueError

invalid profile name {profile_name!r}; expected one of {vali

Error message

invalid profile name {profile_name!r}; expected one of {valid_profile_names!r}

What it means

Validation in set_profile (polars.testing.parametric): after normalising the input (taking the last dotted component and translating numeric strings), the profile name is not one of the allowed ParametricProfileNames literals ('fast', 'balanced', 'thorough', etc.). Usually caused by a typo or an unknown custom profile string.

Source

Thrown at py-polars/src/polars/testing/parametric/profiles.py:105

        a custom profile with that value).

    Examples
    --------
    >>> # prefer the 'balanced' profile for running parametric tests
    >>> from polars.testing.parametric import set_profile
    >>> set_profile("balanced")
    """
    profile_name = str(profile).split(".")[-1]
    if profile_name.replace("_", "").isdigit():
        profile_name = str(int(profile_name))

    else:
        from typing import get_args

        valid_profile_names = get_args(ParametricProfileNames)
        if profile_name not in valid_profile_names:
            msg = f"invalid profile name {profile_name!r}; expected one of {valid_profile_names!r}"
            raise ValueError(msg)

    os.environ["POLARS_HYPOTHESIS_PROFILE"] = profile_name

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Pass one of the valid profile names listed in the error to `load_profile`/`set_profile`, or define a new profile first.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at py-polars/src/polars/testing/parametric/profiles.py:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/0862f7cd6c7421da. Report an issue: GitHub.