{"record":{"id":"7383d61b1cbc3c89","repo":"run-llama/llama_index","slug":"prefix-messages-is-not-supported-for-condensequest","errorCode":null,"errorMessage":"prefix_messages is not supported for CondenseQuestionChatEngine.","messagePattern":"prefix_messages is not supported for CondenseQuestionChatEngine\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/chat_engine/condense_question.py","lineNumber":104,"sourceCode":"        llm: Optional[LLM] = None,\n        **kwargs: Any,\n    ) -> \"CondenseQuestionChatEngine\":\n        \"\"\"Initialize a CondenseQuestionChatEngine from default parameters.\"\"\"\n        condense_question_prompt = condense_question_prompt or DEFAULT_PROMPT\n\n        llm = llm or Settings.llm\n\n        chat_history = chat_history or []\n        memory = memory or memory_cls.from_defaults(\n            chat_history=chat_history, token_limit=llm.metadata.context_window - 256\n        )\n\n        if system_prompt is not None:\n            raise NotImplementedError(\n                \"system_prompt is not supported for CondenseQuestionChatEngine.\"\n            )\n        if prefix_messages is not None:\n            raise NotImplementedError(\n                \"prefix_messages is not supported for CondenseQuestionChatEngine.\"\n            )\n\n        return cls(\n            query_engine,\n            condense_question_prompt,\n            memory,\n            llm,\n            verbose=verbose,\n            callback_manager=Settings.callback_manager,\n        )\n\n    def _condense_question(\n        self, chat_history: List[ChatMessage], last_message: str\n    ) -> str:\n        \"\"\"\n        Generate standalone question from conversation context and last message.\n        \"\"\"","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/chat_engine/condense_question.py#L86-L122","documentation":"CondenseQuestionChatEngine.from_defaults() raises NotImplementedError when prefix_messages is passed. The engine delegates each turn to a query engine after condensing the question, and never prepends prefix messages to LLM calls, so the parameter is explicitly unsupported rather than ignored.","triggerScenarios":"CondenseQuestionChatEngine.from_defaults(query_engine=qe, prefix_messages=[ChatMessage(...)]) — the `if prefix_messages is not None` guard fires immediately after the system_prompt check. Typically reached via generic engine-construction code that forwards prefix_messages to every engine type.","commonSituations":"Factory code shared across chat engines passing prefix_messages uniformly; porting a SimpleChatEngine setup (which accepts prefix_messages) to CondenseQuestionChatEngine.","solutions":["Remove prefix_messages from the call for this engine type","Use ContextChatEngine or SimpleChatEngine, which accept prefix_messages","Use CondensePlusContextChatEngine with system_prompt for persona + context needs","If you control the condense prompt, encode necessary instructions there instead"],"exampleFix":"# before\nengine = CondenseQuestionChatEngine.from_defaults(\n    query_engine=qe,\n    prefix_messages=[ChatMessage(role='system', content='Be terse')],\n)  # NotImplementedError\n\n# after\nfrom llama_index.core.chat_engine import SimpleChatEngine\nengine = SimpleChatEngine.from_defaults(\n    prefix_messages=[ChatMessage(role='system', content='Be terse')],\n)","handlingStrategy":"validation","validationCode":"if engine_cls is CondenseQuestionChatEngine:\n    assert prefix_messages is None, 'CondenseQuestionChatEngine does not accept prefix_messages; use ContextChatEngine or SimpleChatEngine'","typeGuard":null,"tryCatchPattern":"try:\n    engine = CondenseQuestionChatEngine.from_defaults(query_engine=qe, **kwargs)\nexcept NotImplementedError as e:\n    raise ConfigError(str(e)) from e","preventionTips":["Do not forward prefix_messages to engines you have not verified support it","Centralize engine construction and whitelist kwargs per engine type"],"tags":["llama-index","chat-engine","unsupported-argument","condense-question"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}