{"record":{"id":"5f7337f828cc5e74","repo":"pandas-dev/pandas","slug":"no-such-keys-s-for-pat","errorCode":null,"errorMessage":"No such keys(s) for {pat=}","messagePattern":"No such keys\\(s\\) for (.+?)","errorType":"exception","errorClass":"OptionError","httpStatus":null,"severity":"error","filePath":"pandas/_config/config.py","lineNumber":335,"sourceCode":"    --------\n    get_option : Retrieve the value of the specified option.\n    set_option : Set the value of the specified option or options.\n    reset_option : Reset one or more options to their default value.\n\n    Notes\n    -----\n    For all available options, please view the\n    :ref:`User Guide <options.available>`.\n\n    Examples\n    --------\n    >>> pd.describe_option(\"display.max_columns\")  # doctest: +SKIP\n    display.max_columns : int\n        If max_cols is exceeded, switch to truncate view...\n    \"\"\"\n    keys = _select_options(pat)\n    if len(keys) == 0:\n        raise OptionError(f\"No such keys(s) for {pat=}\")\n\n    s = \"\\n\".join([_build_option_description(k) for k in keys])\n\n    if _print_desc:\n        print(s)\n        return None\n    return s\n\n\ndef reset_option(pat: str) -> None:\n    \"\"\"\n    Reset one or more options to their default value.\n\n    This method resets the specified pandas option(s) back to their default\n    values. It allows partial string matching for convenience, but users should\n    exercise caution to avoid unintended resets due to changes in option names\n    in future versions.\n","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/pandas-dev/pandas/blob/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/_config/config.py#L317-L353","documentation":"Raised by describe_option (config.py:333-335) when _select_options returns no keys for the given pattern. Unlike _get_single_key, describe does not go through _translate_key; it just checks the registered set.","triggerScenarios":"pd.describe_option('does.not.exist') where the pattern matches zero registered options.","commonSituations":"Asking for the description of a misspelled or removed option, or a key that exists only under a different namespace.","solutions":["Call pd.describe_option() with no argument to dump all available keys.","Confirm the key is registered: `import pandas._config.config as cf; cf._registered_options.get(key)`.","Catch OptionError when describing user-supplied option names."],"exampleFix":"# before\npd.describe_option('displya.max_columns')  # No such keys(s) for pat='displya.max_columns'\n\n# after\npd.describe_option('display.max_columns')","handlingStrategy":"try-catch","validationCode":"import pandas._config.config as cf\ndef safe_describe(pat: str) -> str | None:\n    if not cf._select_options(pat):\n        return None\n    return pd.describe_option(pat, _print_desc=False)","typeGuard":"def has_description(pat: str) -> bool:\n    import pandas._config.config as cf\n    return bool(cf._select_options(pat))","tryCatchPattern":"from pandas.errors import OptionError\ntry:\n    pd.describe_option(user_pat)\nexcept OptionError:\n    print('Unknown option; listing all:')\n    pd.describe_option()","preventionTips":["Validate user-supplied option names against cf._registered_options.","Cache a list of valid keys at startup for autocomplete.","Provide a fallback to pd.describe_option() with no args when the pattern is unknown."],"tags":["config","describe-option","typo"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}