{"record":{"id":"8ea3cf82946ded8f","repo":"microsoft/semantic-kernel","slug":"the-prompt-execution-settings-must-not-have-a-resp","errorCode":null,"errorMessage":"The prompt execution settings must not have a response format set.","messagePattern":"The prompt execution settings must not have a response format set\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/orchestration/magentic.py","lineNumber":257,"sourceCode":"                - task_ledger_facts_prompt: The prompt to use for the task ledger facts.\n                - task_ledger_plan_prompt: The prompt to use for the task ledger plan.\n                - task_ledger_full_prompt: The prompt to use for the full task ledger.\n                - task_ledger_facts_update_prompt: The prompt to use for the task ledger facts update.\n                - task_ledger_plan_update_prompt: The prompt to use for the task ledger plan update.\n                - progress_ledger_prompt: The prompt to use for the progress ledger.\n                - final_answer_prompt: The prompt to use for the final answer.\n        \"\"\"\n        # Bast effort to make sure the service supports structured output. Even if the service supports\n        # structured output, the model may not support it, in which case there is no good way to check.\n        if prompt_execution_settings is None:\n            prompt_execution_settings = chat_completion_service.instantiate_prompt_execution_settings()\n            if not hasattr(prompt_execution_settings, \"response_format\"):\n                raise ValueError(\"The service must support structured output.\")\n        else:\n            if not hasattr(prompt_execution_settings, \"response_format\"):\n                raise ValueError(\"The service must support structured output.\")\n            if getattr(prompt_execution_settings, \"response_format\", None) is not None:\n                raise ValueError(\"The prompt execution settings must not have a response format set.\")\n\n        super().__init__(\n            chat_completion_service=chat_completion_service,\n            prompt_execution_settings=prompt_execution_settings,\n            **kwargs,\n        )\n\n    @override\n    async def plan(self, magentic_context: MagenticContext) -> ChatMessageContent:\n        \"\"\"Plan the task.\n\n        Args:\n            magentic_context (MagenticContext): The context for the Magentic manager.\n\n        Returns:\n            ChatMessageContent: The task ledger.\n        \"\"\"\n        # 1. Gather the facts","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/orchestration/magentic.py#L239-L275","documentation":"StandardMagenticManager parses the model's progress/facts/plan ledgers via structured output, so it sets response_format on the prompt execution settings itself during construction. If the settings object you pass already carries a non-null response_format, the manager's own structured-output contract would be overwritten or made ambiguous, so the constructor rejects it. This is a configuration guard, not a runtime failure.","triggerScenarios":"Constructing `StandardMagenticManager(chat_completion_service, prompt_execution_settings=settings)` where `getattr(settings, 'response_format', None) is not None`. Also triggered when settings lack the `response_format` attribute entirely (different message, same method).","commonSituations":"Reusing a PromptExecutionSettings instance that was configured for a separate structured-output call (json_schema/auto). Copying settings from another function that set response_format. Using a connector whose settings default response_format to a non-null value.","solutions":["Pass prompt_execution_settings=None and let the manager instantiate fresh settings from the service.","Before passing settings, clear the field: settings.response_format = None.","Use a chat completion service/connector that exposes the response_format attribute so the manager can manage structured output itself."],"exampleFix":"// before\nsettings = AzureChatPromptExecutionSettings(response_format=JsonSchemaResponseFormat(my_schema))\nmanager = StandardMagenticManager(service, prompt_execution_settings=settings)  # raises\n\n// after\nsettings = AzureChatPromptExecutionSettings()\nmanager = StandardMagenticManager(service, prompt_execution_settings=settings)","handlingStrategy":"validation","validationCode":"# Before constructing StandardMagenticManager\nsettings = chat_completion_service.instantiate_prompt_execution_settings()\nif not hasattr(settings, \"response_format\"):\n    raise ValueError(\"Service must support structured output (response_format attr).\")\nif getattr(settings, \"response_format\", None) is not None:\n    settings.response_format = None  # let the manager own structured output\nmanager = StandardMagenticManager(chat_completion_service, prompt_execution_settings=settings)","typeGuard":"def is_clean_for_magentic(settings) -> bool:\n    return hasattr(settings, \"response_format\") and getattr(settings, \"response_format\", None) is None","tryCatchPattern":"try:\n    manager = StandardMagenticManager(service, prompt_execution_settings=settings)\nexcept ValueError as e:\n    if \"response format\" in str(e):\n        settings.response_format = None\n        manager = StandardMagenticManager(service, prompt_execution_settings=settings)\n    else:\n        raise","preventionTips":["Pass prompt_execution_settings=None unless you need custom non-response-format settings.","Never reuse a settings object that carried response_format from another structured-output call.","Prefer a connector/service known to support structured output."],"tags":["semantic-kernel","magentic","structured-output","configuration","init"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}