{"record":{"id":"05dc41ffdbfd83c9","repo":"pandas-dev/pandas","slug":"value-must-be-one-of-pp-values","errorCode":null,"errorMessage":"Value must be one of {pp_values}","messagePattern":"Value must be one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pandas/_config/config.py","lineNumber":902,"sourceCode":"        if not isinstance(x, _type):\n            raise ValueError(f\"Value must be an instance of {type_repr}\")\n\n    return inner\n\n\ndef is_one_of_factory(legal_values: Sequence) -> Callable[[Any], None]:\n    callables = [c for c in legal_values if callable(c)]\n    legal_values = [c for c in legal_values if not callable(c)]\n\n    def inner(x: object) -> None:\n        if x not in legal_values:\n            if not any(c(x) for c in callables):\n                uvals = [str(lval) for lval in legal_values]\n                pp_values = \"|\".join(uvals)\n                msg = f\"Value must be one of {pp_values}\"\n                if len(callables):\n                    msg += \" or a callable\"\n                raise ValueError(msg)\n\n    return inner\n\n\ndef is_nonnegative_int(value: object) -> None:\n    \"\"\"\n    Verify that value is None or a positive int.\n\n    Parameters\n    ----------\n    value : None or int\n            The `value` to be checked.\n\n    Raises\n    ------\n    ValueError\n        When the value is not None or is a negative integer\n    \"\"\"","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/_config/config.py#L884-L920","documentation":"Raised by the is_one_of_factory validator, which restricts a config option to a fixed list of legal values (optionally plus callables). When set_option() is called with a value not in the legal set, it raises ValueError listing the allowed values. The shipped usage is io/pytables.py:235 registering the format option with legal values ['fixed', 'table', None].","triggerScenarios":"Calling pd.set_option('io.hdf.table.format', value) with anything other than 'fixed', 'table', or None triggers the check (the HDF5 format option). Registering a custom option with validator=cf.is_one_of_factory([...]) and setting an out-of-set value does the same.","commonSituations":"Typing a format string (e.g. 'csv' or 'parquet') that isn't a valid HDF format; passing a value from an unvalidated config file; confusion about whether None is a valid sentinel.","solutions":["Use one of the legal values listed in the error message — for HDF format that is 'fixed', 'table', or None.","Run pd.describe_option('io.hdf.table.format') to see the allowed values before setting.","If writing your own option, re-read the legal_values list you passed to is_one_of_factory."],"exampleFix":"# before\npd.set_option('io.hdf.table.format', 'csv')\n\n# after\npd.set_option('io.hdf.table.format', 'table')","handlingStrategy":"validation","validationCode":"legal = ['fixed', 'table', None]\nvalue = get_format()\nif value not in legal:\n    raise ValueError(f'format must be one of {legal}, got {value!r}')\npd.set_option('io.hdf.table.format', value)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the legal-values list next to the set_option call as a constant.","Validate config-file inputs against the allowed set before applying.","Use pd.describe_option(key) to confirm accepted values."],"tags":["config","validation","set-option","pytables","valueerror"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}