langchain-ai/langchain · error · ValueError

No colors available after applying exclusions.

Error message

No colors available after applying exclusions.

What it means

Error "No colors available after applying exclusions." thrown in langchain-ai/langchain.

Source

Thrown at libs/core/langchain_core/utils/input.py:34

) -> dict[str, str]:
    """Get mapping for items to a support color.

    Args:
        items: The items to map to colors.
        excluded_colors: The colors to exclude.

    Returns:
        The mapping of items to colors.

    Raises:
        ValueError: If no colors are available after applying exclusions.
    """
    colors = list(_TEXT_COLOR_MAPPING.keys())
    if excluded_colors is not None:
        colors = [c for c in colors if c not in excluded_colors]
    if not colors:
        msg = "No colors available after applying exclusions."
        raise ValueError(msg)
    return {item: colors[i % len(colors)] for i, item in enumerate(items)}


def get_colored_text(text: str, color: str) -> str:
    """Get colored text.

    Args:
        text: The text to color.
        color: The color to use.

    Returns:
        The colored text.
    """
    color_str = _TEXT_COLOR_MAPPING[color]
    return f"\u001b[{color_str}m\033[1;3m{text}\u001b[0m"


def get_bolded_text(text: str) -> str:

View on GitHub (pinned to e32fa9a52e)

Solutions

  1. Reduce the exclude_colors list so at least one color remains available.
  2. Remove the exclusions entirely to use the full default color set.

Example fix

get_color_mapping(items, excluded_colors=[c for c in excluded if c != 'red'])

When it happens

Trigger: Raised when get_color_mapping is asked for colors but the set of available colors is entirely removed by the excluded_colors set.

Common situations: See trigger scenarios.


AI-assisted analysis of langchain-ai/langchain@e32fa9a52e (2026-08-14). Data as JSON: /api/errors/b66d0ad51f4222d4. Report an issue: GitHub.