{"record":{"id":"ec4a36181f732715","repo":"microsoft/autogen","slug":"multiple-and-not-continuous-system-messages-are-no","errorCode":null,"errorMessage":"Multiple and Not continuous system messages are not supported","messagePattern":"Multiple and Not continuous system messages are not supported","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py","lineNumber":507,"sourceCode":"            return {\"role\": \"unknown\", \"content\": str(message)}\n\n    def _merge_system_messages(self, messages: Sequence[LLMMessage]) -> Sequence[LLMMessage]:\n        \"\"\"\n        Merge continuous system messages into a single message.\n        \"\"\"\n        _messages: List[LLMMessage] = []\n        system_message_content = \"\"\n        _first_system_message_idx = -1\n        _last_system_message_idx = -1\n        # Index of the first system message for adding the merged system message at the correct position\n        for idx, message in enumerate(messages):\n            if isinstance(message, SystemMessage):\n                if _first_system_message_idx == -1:\n                    _first_system_message_idx = idx\n                elif _last_system_message_idx + 1 != idx:\n                    # That case, system message is not continuous\n                    # Merge system messages only contiues system messages\n                    raise ValueError(\"Multiple and Not continuous system messages are not supported\")\n                system_message_content += message.content + \"\\n\"\n                _last_system_message_idx = idx\n            else:\n                _messages.append(message)\n        system_message_content = system_message_content.rstrip()\n        if system_message_content != \"\":\n            system_message = SystemMessage(content=system_message_content)\n            _messages.insert(_first_system_message_idx, system_message)\n        messages = _messages\n\n        return messages\n\n    def _get_thinking_config(self, extra_create_args: Mapping[str, Any]) -> Dict[str, Any]:\n        \"\"\"\n        Get the thinking configuration for API calls\n\n        Args:\n            extra_create_args: Extra arguments that may contain thinking config","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py#L489-L525","documentation":"Error \"Multiple and Not continuous system messages are not supported\" thrown in microsoft/autogen.","triggerScenarios":"Thrown at python/packages/autogen-ext/src/autogen_ext/models/anthropic/_anthropic_client.py:507 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Merge system content into a single system message"],"exampleFix":"Combine system messages into one before sending","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}