{"record":{"id":"bb103c0abff14508","repo":"pypa/pip","slug":"no-such-key-orig-key","errorCode":null,"errorMessage":"No such key - {orig_key}","messagePattern":"No such key - (.+?)","errorType":"exception","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/configuration.py","lineNumber":157,"sourceCode":"        \"\"\"Returns key-value pairs like dict.items() representing the loaded\n        configuration\n        \"\"\"\n        return self._dictionary.items()\n\n    def get_value(self, key: str) -> Any:\n        \"\"\"Get a value from the configuration.\"\"\"\n        orig_key = key\n        key = _normalize_name(key)\n        try:\n            clean_config: dict[str, Any] = {}\n            for file_values in self._dictionary.values():\n                clean_config.update(file_values)\n            return clean_config[key]\n        except KeyError:\n            # disassembling triggers a more useful error message than simply\n            # \"No such key\" in the case that the key isn't in the form command.option\n            _disassemble_key(key)\n            raise ConfigurationError(f\"No such key - {orig_key}\")\n\n    def set_value(self, key: str, value: Any) -> None:\n        \"\"\"Modify a value in the configuration.\"\"\"\n        key = _normalize_name(key)\n        self._ensure_have_load_only()\n\n        assert self.load_only\n        fname, parser = self._get_parser_to_modify()\n\n        if parser is not None:\n            section, name = _disassemble_key(key)\n\n            # Modify the parser and the configuration\n            if not parser.has_section(section):\n                parser.add_section(section)\n            parser.set(section, name, value)\n\n        self._config[self.load_only].setdefault(fname, {})","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/configuration.py#L139-L175","documentation":"Raised by Configuration.get_value() after merging all loaded configuration layers into a flat dict and failing to find the requested key. Before raising, it calls _disassemble_key to produce a better hint if the key lacks a dot. This surfaces when a user queries a config key that does not exist in any loaded layer (file or environment).","triggerScenarios":"Running `pip config get global.nonexistent` or `pip config get some.typo` where the key is not present in any pip.conf or PIP_ environment variable.","commonSituations":"Querying an option before it has been set; misspelling a key; expecting a default value to appear in config (pip only stores explicitly-set values, not defaults).","solutions":["Verify the key exists with `pip config list` or `pip config debug`.","Set the key first with `pip config set global.<name> <value>` if you intended it to exist.","Check the spelling and section prefix against pip's documented options."],"exampleFix":"# before\npip config get global.index-url   # not set yet\n# after\npip config set global.index-url https://pypi.org/simple\npip config get global.index-url","handlingStrategy":"validation","validationCode":"from pip._internal.configuration import Configuration\n\ndef config_get_safe(cfg: Configuration, key: str, default=None):\n    try:\n        return cfg.get_value(key)\n    except Exception:  # ConfigurationError\n        return default\n","typeGuard":null,"tryCatchPattern":"from pip._internal.exceptions import ConfigurationError\ntry:\n    value = cfg.get_value(key)\nexcept ConfigurationError:\n    value = None  # key not set; use default\n","preventionTips":["Use `pip config list`/`pip config debug` to confirm keys before querying.","Remember pip does not store defaults — only explicitly-set values appear in config."],"tags":["pip","config","configuration","key-not-found"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}