{"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/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_vendor/pygments/formatters/__init__.py#L62-L98","documentation":"Raised by get_formatter_by_name when find_formatter_class returns None, meaning no builtin or plugin formatter has the supplied alias in its aliases list. This is the primary lookup-by-name failure for formatters.","triggerScenarios":"Calling get_formatter_by_name('htm') (typo), get_formatter_by_name('pdf') (no such formatter), or any alias not registered by builtin FORMATTERS or setuptools entry-point plugins.","commonSituations":"Typo in the formatter alias read from CLI/config; depending on a formatter provided by a plugin that isn't installed; formatter renamed/removed across pygments versions.","solutions":["Spell the alias correctly (e.g. 'html', 'terminal', 'terminal16m', 'latex').","List valid names via pygments.formatters.FORMATTERS or list(get_all_formatters()).","Install the plugin package that registers the missing formatter."],"exampleFix":"# before\nfmt = get_formatter_by_name('htm')\n# after\nfmt = get_formatter_by_name('html')","handlingStrategy":"try-catch","validationCode":"from pygments.formatters import find_formatter_class\nif find_formatter_class(alias) is None:\n    raise ValueError(f'unknown formatter alias {alias!r}')","typeGuard":"from pygments.formatters import find_formatter_class\ndef is_known_formatter(alias):\n    return find_formatter_class(alias) is not None","tryCatchPattern":"from pygments.util import ClassNotFound\ntry:\n    fmt = get_formatter_by_name(alias)\nexcept ClassNotFound:\n    fmt = get_formatter_by_name('terminal')  # safe fallback","preventionTips":["Validate the alias against get_all_formatters() before use.","Pin pygments version if you rely on specific formatters."],"tags":["pygments","formatter","lookup"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}