pypa/pip · error · ConfigurationError
Fatal Internal error [id=1]. Please report as a bug.
Error message
Fatal Internal error [id=1]. Please report as a bug.
What it means
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).
Source
Thrown at src/pip/_internal/configuration.py:200
key = _normalize_name(key)
self._ensure_have_load_only()
assert self.load_only
fname, parser = self._get_parser_to_modify()
if (
key not in self._config[self.load_only][fname]
and key not in self._config[self.load_only]
):
raise ConfigurationError(f"No such key - {orig_key}")
if parser is not None:
section, name = _disassemble_key(key)
if not (
parser.has_section(section) and parser.remove_option(section, name)
):
# The option was not removed.
raise ConfigurationError(
"Fatal Internal error [id=1]. Please report as a bug."
)
# The section may be empty after the option was removed.
if not parser.items(section):
parser.remove_section(section)
self._mark_as_modified(fname, parser)
try:
del self._config[self.load_only][fname][key]
except KeyError:
del self._config[self.load_only][key]
def save(self) -> None:
"""Save the current in-memory state."""
self._ensure_have_load_only()
for fname, parser in self._modified_parsers:
logger.info("Writing to %s", fname)View on GitHub (pinned to d7d0d0a394)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
# No reliable pre-validation; this is an internal inconsistency.
# Mitigate by ensuring no concurrent edits to the config file while pip runs.
import fcntl, os
lockpath = os.path.expanduser('~/.pip/pip.conf.lock')
with open(lockpath, 'w') as lock:
fcntl.flock(lock, fcntl.LOCK_EX)
# run pip config unset here Try / catch
from pip._internal.exceptions import ConfigurationError
try:
cfg.unset_value('global.foo')
except ConfigurationError as e:
if 'Fatal Internal error' in str(e):
# resync: reload config from disk and retry once, or edit the file manually
cfg.load()
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Internal Error.
- Key does not contain dot separated section and key. Perhaps
- Got invalid value for load_only - should be one of {}
- No such key - {orig_key}
- An error occurred while writing to the configuration file {f
AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04).
Data as JSON: /data/errors/a421cfee20fdf804.json.
Report an issue: GitHub.