{"record":{"id":"e78c5b0599d44dda","repo":"langchain-ai/langgraph","slug":"must-specify-non-null-arguments-for-both-left-an","errorCode":null,"errorMessage":"Must specify non-null arguments for both 'left' and 'right'. Only received: '{'left' if left else 'right'}'.","messagePattern":"Must specify non-null arguments for both 'left' and 'right'\\. Only received: '(.+?)'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/langgraph/langgraph/graph/message.py","lineNumber":52,"sourceCode":")\n\nMessages = list[MessageLikeRepresentation] | MessageLikeRepresentation\n\nREMOVE_ALL_MESSAGES = \"__remove_all__\"\n\n\ndef _add_messages_wrapper(func: Callable) -> Callable[[Messages, Messages], Messages]:\n    def _add_messages(\n        left: Messages | None = None, right: Messages | None = None, **kwargs: Any\n    ) -> Messages | Callable[[Messages, Messages], Messages]:\n        if left is not None and right is not None:\n            return func(left, right, **kwargs)\n        elif left is not None or right is not None:\n            msg = (\n                f\"Must specify non-null arguments for both 'left' and 'right'. Only \"\n                f\"received: '{'left' if left else 'right'}'.\"\n            )\n            raise ValueError(msg)\n        else:\n            return partial(func, **kwargs)\n\n    _add_messages.__doc__ = func.__doc__\n    return cast(Callable[[Messages, Messages], Messages], _add_messages)\n\n\n@_add_messages_wrapper\ndef add_messages(\n    left: Messages,\n    right: Messages,\n    *,\n    format: Literal[\"langchain-openai\"] | None = None,\n) -> Messages:\n    \"\"\"Merges two lists of messages, updating existing messages by ID.\n\n    By default, this ensures the state is \"append-only\", unless the\n    new message has the same ID as an existing message.","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/langgraph/langgraph/graph/message.py#L34-L70","documentation":"Error \"Must specify non-null arguments for both 'left' and 'right'. Only received: '{'left' if left else 'right'}'.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/langgraph/langgraph/graph/message.py:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}