Skip to content

The agent engineering platform.

fix(core): add no colors check (#33780)

Michael Li6617865440fe
diff --git a/libs/core/langchain_core/utils/input.py b/libs/core/langchain_core/utils/input.py
index 80c9c63303..d8946230bf 100644
--- a/libs/core/langchain_core/utils/input.py
+++ b/libs/core/langchain_core/utils/input.py
@@ -26,6 +26,9 @@ def get_color_mapping(
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)}