{"id":"a421cfee20fdf804","repo":"pypa/pip","slug":"fatal-internal-error-id-1-please-report-as-a-bu","errorCode":null,"errorMessage":"Fatal Internal error [id=1]. Please report as a bug.","messagePattern":"Fatal Internal error \\[id=1\\]\\. Please report as a bug\\.","errorType":"exception","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/configuration.py","lineNumber":200,"sourceCode":"        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 (\n            key not in self._config[self.load_only][fname]\n            and key not in self._config[self.load_only]\n        ):\n            raise ConfigurationError(f\"No such key - {orig_key}\")\n\n        if parser is not None:\n            section, name = _disassemble_key(key)\n            if not (\n                parser.has_section(section) and parser.remove_option(section, name)\n            ):\n                # The option was not removed.\n                raise ConfigurationError(\n                    \"Fatal Internal error [id=1]. Please report as a bug.\"\n                )\n\n            # The section may be empty after the option was removed.\n            if not parser.items(section):\n                parser.remove_section(section)\n            self._mark_as_modified(fname, parser)\n        try:\n            del self._config[self.load_only][fname][key]\n        except KeyError:\n            del self._config[self.load_only][key]\n\n    def save(self) -> None:\n        \"\"\"Save the current in-memory state.\"\"\"\n        self._ensure_have_load_only()\n\n        for fname, parser in self._modified_parsers:\n            logger.info(\"Writing to %s\", fname)","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/configuration.py#L182-L218","documentation":"Raised as ConfigurationError in Configuration.unset_value() at configuration.py:196-202 when the in-memory state said the key exists but the underlying RawConfigParser reports the section is absent or parser.remove_option(section, name) returns False. This indicates an internal inconsistency between pip's cached config view and the parser — a state the code considers unreachable, hence the 'report as a bug' message (id=1).","triggerScenarios":"An internal desynchronization between self._config (the dict view) and the RawConfigParser objects after concurrent modification, a hand-edited config file changed underneath pip, or a bug in pip's own bookkeeping. The guard at configuration.py:196-198 fires when the parser cannot remove the option it was told to remove.","commonSituations":"Editing the pip.conf file externally while a 'pip config unset' runs; a pip bug in older versions; corrupted config parsing state. This is genuinely rare and almost always indicates a pip bug or external file mutation.","solutions":["Report it as a bug to pip with the exact sequence that triggered it.","Manually edit the config file to remove the offending key, then retry.","Restart the command — if it was a transient concurrent-edit, a fresh run on a stable file should succeed.","Run 'pip config debug' to inspect the parsed state of all config files."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# No reliable pre-validation; this is an internal inconsistency.\n# Mitigate by ensuring no concurrent edits to the config file while pip runs.\nimport fcntl, os\nlockpath = os.path.expanduser('~/.pip/pip.conf.lock')\nwith open(lockpath, 'w') as lock:\n    fcntl.flock(lock, fcntl.LOCK_EX)\n    # run pip config unset here","typeGuard":null,"tryCatchPattern":"from pip._internal.exceptions import ConfigurationError\ntry:\n    cfg.unset_value('global.foo')\nexcept ConfigurationError as e:\n    if 'Fatal Internal error' in str(e):\n        # resync: reload config from disk and retry once, or edit the file manually\n        cfg.load()\n    else:\n        raise","preventionTips":["Do not hand-edit the config file while a 'pip config unset' is running.","Treat this error as a signal to reload config from disk before retrying.","Report persistent occurrences as a pip bug with reproduction steps."],"tags":["pip","config","configuration","internal-error","bug"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}