{"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/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/_config/config.py#L317-L353","documentation":"Raised by `describe_option(pat)` when `_select_options(pat)` returns zero matches. Unlike `_get_single_key`, `describe_option` does not require a unique match (it describes all hits), but it still errors on zero. The message uses Python's `{pat=}` debug format so it prints as `pat='...'`.","triggerScenarios":"`pd.describe_option('nonexistent.option')` or any pattern matching no registered option.","commonSituations":"Typo when asking for documentation of an option; asking about an option removed in the installed pandas version.","solutions":["Call `pd.describe_option()` with no argument to list and describe every registered option, then copy the exact key.","Fix the typo and retry.","If the option seems gone, check the pandas version/changelog."],"exampleFix":"# before\npd.describe_option('display.max_rowss')   # typo -> OptionError\n\n# after\npd.describe_option()                      # lists all options\npd.describe_option('display.max_rows')","handlingStrategy":"validation","validationCode":"from pandas._config.config import _select_options\ndef describe_or_none(pat: str):\n    if not _select_options(pat):\n        return None  # caller typo; optionally list all via describe_option()\n    import pandas as pd\n    return pd.describe_option(pat)","typeGuard":"def has_matching_option(pat: str) -> bool:\n    import pandas._config.config as c\n    return len(c._select_options(pat)) > 0","tryCatchPattern":"from pandas._config.config import OptionError\ntry:\n    pd.describe_option(user_key)\nexcept OptionError:\n    # fall back to listing all options for the user\n    pd.describe_option()","preventionTips":["Validate option patterns against `_select_options` before describing.","Keep a curated allowlist of option names if they come from user config files.","Run `pd.describe_option()` once during onboarding to learn valid keys."],"tags":["config","describe-option","typo","option-error"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}