deepset-ai/haystack · error · NotImplementedError

SearchableToolset does not support concatenation.

Error message

SearchableToolset does not support concatenation.

What it means

SearchableToolset manages its tool catalog dynamically (search/select), so the Toolset '+' concatenation operator is intentionally unsupported. Using searchable_toolset + other_tool raises NotImplementedError rather than silently producing a broken set.

Source

Thrown at haystack/tools/searchable_toolset.py:142

        self._search_tool_description = search_tool_description
        self._search_tool_parameters_description = search_tool_parameters_description

        # Runtime state (initialized in warm_up)
        self._discovered_tools: dict[str, Tool] = {}
        self._bootstrap_tool: Tool | None = None
        self._document_store: InMemoryDocumentStore | None = None
        self._passthrough: bool | None = None

        # Optional per-run name filter, set on the copies returned by spawn(). When set, iteration only
        # yields tools whose name is in this set, and search is scoped to it. None means no filtering.
        self._selected_tool_names: set[str] | None = None

        # Initialize parent with empty tools list - we manage tools dynamically
        super().__init__(tools=[])

    def __add__(self, other: Tool | Toolset | list[Tool]) -> "Toolset":
        """Concatenation is not supported for SearchableToolset."""
        raise NotImplementedError("SearchableToolset does not support concatenation.")

    def add(self, tool: Tool | Toolset) -> None:
        """Adding new tools after initialization is not supported for SearchableToolset."""
        raise NotImplementedError("SearchableToolset does not support adding new tools after initialization.")

    def warm_up(self) -> None:
        """
        Prepare the toolset for use.

        Warms up the catalog (so lazy toolsets like MCPToolset can connect) and flattens it. Above the passthrough
        threshold, it also indexes the catalog and creates the search_tools bootstrap tool.

        This method is idempotent: it only warms up the toolset the first time it is called.

        :raises ValueError: If the flattened catalog contains tools with duplicate names.
        """
        if self._passthrough is not None:
            return

View on GitHub (pinned to e318778c9b)

Solutions

  1. Include the extra tools in the catalog list at construction: SearchableToolset(catalog=[...tools, extra_tool])
  2. Use a plain Toolset if you need + concatenation and don't need search semantics
  3. Build a combined list first and pass it once to SearchableToolset(catalog=combined)

Example fix

// before
ts = searchable_toolset + extra_tool

// after
ts = SearchableToolset(catalog=list(base_catalog) + [extra_tool])
Defensive patterns

Strategy: fallback

Validate before calling

def combine_toolsets(a, b):
    from haystack.tools import SearchableToolset, Toolset
    if isinstance(a, SearchableToolset) or isinstance(b, SearchableToolset):
        return SearchableToolset(catalog=[a, b])
    return a + b

Type guard

def supports_concat(toolset) -> bool:
    return not isinstance(toolset, SearchableToolset)

Try / catch

try:
    combined = searchable + extra
except NotImplementedError:
    combined = SearchableToolset(catalog=[searchable, extra])

Prevention

When it happens

Trigger: combined = searchable_toolset + another_tool or searchable + [t1, t2]; also occurrences where code sums a mixed list of toolsets with sum()/reduce.

Common situations: Code that concatenates ordinary Toolsets being reused with a SearchableToolset; combining agent tool lists with + idiomatically.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of deepset-ai/haystack@e318778c9b (2026-08-30). Data as JSON: /api/errors/c1915884727e13f2. Report an issue: GitHub.