deepset-ai/haystack · error · ValueError

Unknown join mode '{string}'. Supported modes in AnswerJoine

Error message

Unknown join mode '{string}'. Supported modes in AnswerJoiner are: {list(enum_map.keys())}

What it means

AnswerJoiner.JoinMode.from_str converts a string into a JoinMode enum; unknown strings raise ValueError listing the supported modes. AnswerJoiner currently only supports concatenation.

Source

Thrown at haystack/components/joiners/answer_joiner.py:37

    """
    Enum for AnswerJoiner join modes.
    """

    CONCATENATE = "concatenate"

    def __str__(self) -> str:
        return self.value

    @staticmethod
    def from_str(string: str) -> "JoinMode":
        """
        Convert a string to a JoinMode enum.
        """
        enum_map = {e.value: e for e in JoinMode}
        mode = enum_map.get(string)
        if mode is None:
            msg = f"Unknown join mode '{string}'. Supported modes in AnswerJoiner are: {list(enum_map.keys())}"
            raise ValueError(msg)
        return mode


@component
class AnswerJoiner:
    """
    Merges multiple lists of `Answer` objects into a single list.

    Use this component to combine answers from different Generators into a single list.
    Currently, the component supports only one join mode: `CONCATENATE`.
    This mode concatenates multiple lists of answers into a single list.

    ### Usage example

    In this example, AnswerJoiner merges answers from two different Generators:

    ```python
    from haystack.components.builders import AnswerBuilder

View on GitHub (pinned to e318778c9b)

Solutions

  1. Use join_mode="concatenate" (the only supported mode)
  2. Omit join_mode to use the default
  3. Inspect available modes via [e.value for e in JoinMode] before configuring

Example fix

// before
joiner = AnswerJoiner(join_mode="reciprocal_rank_fusion")
// after
joiner = AnswerJoiner(join_mode="concatenate")
Defensive patterns

Strategy: validation

Validate before calling

from haystack.components.joiners.answer_joiner import AnswerJoiner
mode = "merge"
assert mode in [e.value for e in AnswerJoiner.JoinMode], f"unsupported join_mode: {mode}"

Try / catch

try:
    joiner = AnswerJoiner(join_mode=cfg["join_mode"])
except ValueError as e:
    if "Unknown join mode" in str(e):
        joiner = AnswerJoiner(join_mode="concatenate")  # default

Prevention

When it happens

Trigger: Initializing AnswerJoiner(join_mode="merge"), join_mode="sum", or any string other than the JoinMode enum values (e.g. "concatenate").

Common situations: Copying join_mode settings from other joiners (e.g. DocumentJoiner supports more modes like 'reciprocal_rank_fusion', 'merge'); typo in YAML pipeline config.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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