{"record":{"id":"f1cc5f73d2b2cd0c","repo":"pypa/pip","slug":"no-formatter-found-for-name-alias-r","errorCode":null,"errorMessage":"no formatter found for name {_alias!r}","messagePattern":"no formatter found for name (.+?)","errorType":"exception","errorClass":"ClassNotFound","httpStatus":null,"severity":"error","filePath":"src/pip/_vendor/pygments/formatters/__init__.py","lineNumber":80,"sourceCode":"            if name not in _formatter_cache:\n                _load_formatters(module_name)\n            return _formatter_cache[name]\n    for _, cls in find_plugin_formatters():\n        if alias in cls.aliases:\n            return cls\n\n\ndef get_formatter_by_name(_alias, **options):\n    \"\"\"\n    Return an instance of a :class:`.Formatter` subclass that has `alias` in its\n    aliases list. The formatter is given the `options` at its instantiation.\n\n    Will raise :exc:`pygments.util.ClassNotFound` if no formatter with that\n    alias is found.\n    \"\"\"\n    cls = find_formatter_class(_alias)\n    if cls is None:\n        raise ClassNotFound(f\"no formatter found for name {_alias!r}\")\n    return cls(**options)\n\n\ndef load_formatter_from_file(filename, formattername=\"CustomFormatter\", **options):\n    \"\"\"\n    Return a `Formatter` subclass instance loaded from the provided file, relative\n    to the current directory.\n\n    The file is expected to contain a Formatter class named ``formattername``\n    (by default, CustomFormatter). Users should be very careful with the input, because\n    this method is equivalent to running ``eval()`` on the input file. The formatter is\n    given the `options` at its instantiation.\n\n    :exc:`pygments.util.ClassNotFound` is raised if there are any errors loading\n    the formatter.\n\n    .. versionadded:: 2.2\n    \"\"\"","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_vendor/pygments/formatters/__init__.py#L62-L98","documentation":"Raised by get_formatter_by_name when no built-in or plugin formatter class has the given alias in its 'aliases' list. Returns ClassNotFound. The alias must match one of the entries in a formatter's aliases tuple.","triggerScenarios":"Calling get_formatter_by_name('html5') (alias not registered), a typo, or requesting an alias only available via a plugin that isn't installed. find_formatter_class returns None at __init__.py:78.","commonSituations":"Typo in formatter alias in config; alias removed/renamed between pygments versions; third-party formatter plugin not installed; using the formatter's class name instead of an alias.","solutions":["List available aliases via get_all_formatters() and use a registered alias.","Install the plugin that provides the missing formatter.","Use a documented alias like 'html', 'latex', 'terminal', 'terminal256'."],"exampleFix":"# before\nfmt = get_formatter_by_name('html5')\n# after\nfmt = get_formatter_by_name('html')","handlingStrategy":"try-catch","validationCode":"from pip._vendor.pygments.formatters import find_formatter_class\nif find_formatter_class(alias) is None:\n    raise ValueError(f'unknown formatter alias: {alias}')","typeGuard":"def formatter_alias_exists(alias: str) -> bool:\n    from pip._vendor.pygments.formatters import find_formatter_class\n    return find_formatter_class(alias) is not None","tryCatchPattern":"from pip._vendor.pygments.util import ClassNotFound\ntry:\n    fmt = get_formatter_by_name(alias)\nexcept ClassNotFound:\n    fmt = get_formatter_by_name('text')","preventionTips":["Validate aliases via find_formatter_class.","Keep an allowlist of formatter aliases in config."],"tags":["python","pygments","formatter","validation","vendored"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}