{"record":{"id":"0862f7cd6c7421da","repo":"pola-rs/polars","slug":"invalid-profile-name-profile-name-r-expected-on","errorCode":null,"errorMessage":"invalid profile name {profile_name!r}; expected one of {valid_profile_names!r}","messagePattern":"invalid profile name (.+?); expected one of (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/testing/parametric/profiles.py","lineNumber":105,"sourceCode":"        a custom profile with that value).\n\n    Examples\n    --------\n    >>> # prefer the 'balanced' profile for running parametric tests\n    >>> from polars.testing.parametric import set_profile\n    >>> set_profile(\"balanced\")\n    \"\"\"\n    profile_name = str(profile).split(\".\")[-1]\n    if profile_name.replace(\"_\", \"\").isdigit():\n        profile_name = str(int(profile_name))\n\n    else:\n        from typing import get_args\n\n        valid_profile_names = get_args(ParametricProfileNames)\n        if profile_name not in valid_profile_names:\n            msg = f\"invalid profile name {profile_name!r}; expected one of {valid_profile_names!r}\"\n            raise ValueError(msg)\n\n    os.environ[\"POLARS_HYPOTHESIS_PROFILE\"] = profile_name\n","sourceCodeStart":87,"sourceCodeEnd":108,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/testing/parametric/profiles.py#L87-L108","documentation":"set_profile validates the profile name against the Literal type ParametricProfileNames (fetched via typing.get_args). Unknown names raise ValueError before setting the POLARS_HYPOTHESIS_PROFILE environment variable.","triggerScenarios":"set_profile('fast') misspelled, or using a legacy/removed profile name from older polars versions; loading profiles from config with stale names via load_profile.","commonSituations":"Copying example code from an old blog post after profiles were renamed; typos like 'deafult'; constructing profile names dynamically from user config.","solutions":["Use a valid name; the error lists them (e.g. check get_args(ParametricProfileNames) or current docs).","Fix typos in the profile string.","If driven by config, validate against get_args(ParametricProfileNames) before calling."],"exampleFix":"# before\nset_profile('fast')  # invalid if not in current Literal\n\n# after\nset_profile('low')  # one of the valid profile names","handlingStrategy":"validation","validationCode":"from typing import get_args\nfrom polars.testing.parametric.profiles import ParametricProfileNames\nif profile_name not in get_args(ParametricProfileNames):\n    raise ValueError(f\"bad profile {profile_name!r}\")\nset_profile(profile_name)","typeGuard":null,"tryCatchPattern":"try:\n    set_profile(name)\nexcept ValueError as e:\n    print(e)  # lists valid names\n    set_profile('default')","preventionTips":["Derive choices from get_args(ParametricProfileNames) rather than hardcoding","Update profile names when upgrading polars","Avoid building profile names dynamically from unparsed config"],"tags":["polars","testing","parametric","invalid-value"],"backgroundTag":"invalid-enum-value","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"}