{"record":{"id":"08a8cea5f61f28c4","repo":"pola-rs/polars","slug":"config-has-no-option-opt-r","errorCode":null,"errorMessage":"`Config` has no option {opt!r}","messagePattern":"`Config` has no option (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/config.py","lineNumber":386,"sourceCode":"        self._original_runtime_state = None\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Config):\n            return False\n        return (self._original_state == other._original_state) and (\n            self._context_options == other._context_options\n        )\n\n    def __ne__(self, other: object) -> bool:\n        return not self.__eq__(other)\n\n    def _set_config_params(self, **options: Unpack[ConfigParameters]) -> None:\n        for opt, value in options.items():\n            if not hasattr(self, opt) and not opt.startswith(\"set_\"):\n                opt = f\"set_{opt}\"\n            if not hasattr(self, opt):\n                msg = f\"`Config` has no option {opt!r}\"\n                raise AttributeError(msg)\n            getattr(self, opt)(value)\n\n    @classmethod\n    def load(cls, cfg: str) -> Config:\n        \"\"\"\n        Load (and set) previously saved Config options from a JSON string.\n\n        Parameters\n        ----------\n        cfg : str\n            JSON string produced by `Config.save()`.\n\n        See Also\n        --------\n        load_from_file : Load (and set) Config options from a JSON file.\n        save : Save the current set of Config options as a JSON string or file.\n        \"\"\"\n        try:","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/pola-rs/polars/blob/68506541d2de983056c9eb244e1ea05fab377dfc/py-polars/src/polars/config.py#L368-L404","documentation":"`pl.Config.set(**options)` (and `Config(**options)`) dispatches each keyword to a `Config.set_<name>` method: `_set_config_params` first tries the option name as an attribute, then retries with a `set_` prefix. If neither exists it raises `AttributeError: \\\"'Config' has no option ...\\\"`, meaning the option name is not a real Config option in your polars version.","triggerScenarios":"`pl.Config.set(tbl_formating='ASCII_FULL')` (typo); passing an option that only exists as a POLARS_* env var with no Config method; using an option that was renamed or removed in a different polars version.","commonSituations":"Copy-pasting Config snippets between polars versions where option names changed; typos in kwargs; assuming every POLARS_* environment variable has a Config setter.","solutions":["List the real options and use the exact name: `[n for n in dir(pl.Config) if n.startswith('set_')]`.","If it worked on an older polars, check the changelog for renames/removals and update the name.","If the option has no Config method, set the `POLARS_*` environment variable directly and call `pl.Config.reload_env_vars()`."],"exampleFix":"# before\npl.Config.set(tbl_formating=\"ASCII_FULL\")  # AttributeError: 'Config' has no option 'set_tbl_formating'\n\n# after\npl.Config.set_tbl_formatting(\"ASCII_FULL\")","handlingStrategy":"validation","validationCode":"def safe_config_set(cfg: type, **options) -> None:\n    for opt, value in options.items():\n        attr = opt if hasattr(cfg, opt) else (f\"set_{opt}\" if hasattr(cfg, f\"set_{opt}\") else None)\n        if attr is None:\n            raise AttributeError(\n                f\"unknown Config option {opt!r}; valid: \"\n                f\"{[n[4:] for n in dir(cfg) if n.startswith('set_')]}\"\n            )\n        getattr(cfg, attr)(value)\n\nsafe_config_set(pl.Config, tbl_formatting=\"ASCII_FULL\")","typeGuard":null,"tryCatchPattern":"try:\n    pl.Config.set(**user_options)\nexcept AttributeError as err:\n    bad = err.args[0].split(\"option \")[-1].strip(\"'\")\n    logging.warning(\"skipping unknown Config option %r\", bad)\n    pl.Config.set(**{k: v for k, v in user_options.items() if f\"{k!r}\" not in err.args[0]})","preventionTips":["Discover option names programmatically: [n for n in dir(pl.Config) if n.startswith('set_')].","Pin the polars version in projects that persist Config presets.","Enable mypy/pyright strictness on kwargs typed as ConfigParameters to catch typos at type-check time."],"tags":["config","attributeerror","typo","api-misuse","polars"],"backgroundTag":"invalid-config-option","analyzedSha":"68506541d2de983056c9eb244e1ea05fab377dfc","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}