microsoft/autogen · error · ValueError
Extra create args are invalid: {extra_create_args_keys - cre
Error message
Extra create args are invalid: {extra_create_args_keys - create_kwargs} What it means
Raised at the top of AzureAIChatCompletionClient.create() when extra_create_args contains keys not in the module-level create_kwargs whitelist (the set of parameters ChatCompletionsClient accepts, minus model_info). The error message lists the offending keys (set difference), so you can see exactly which argument names are not recognized.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py:371
if self.model_info["json_output"] is False and json_output is True:
raise ValueError("Model does not support JSON output")
if self.model_info["function_calling"] is False and len(tools) > 0:
raise ValueError("Model does not support function calling")
async def create(
self,
messages: Sequence[LLMMessage],
*,
tools: Sequence[Tool | ToolSchema] = [],
tool_choice: Tool | Literal["auto", "required", "none"] = "auto",
json_output: Optional[bool | type[BaseModel]] = None,
extra_create_args: Mapping[str, Any] = {},
cancellation_token: Optional[CancellationToken] = None,
) -> CreateResult:
extra_create_args_keys = set(extra_create_args.keys())
if not create_kwargs.issuperset(extra_create_args_keys):
raise ValueError(f"Extra create args are invalid: {extra_create_args_keys - create_kwargs}")
# Copy the create args and overwrite anything in extra_create_args
create_args = self._create_args.copy()
create_args.update(extra_create_args)
self._validate_model_info(messages, tools, json_output, create_args)
azure_messages_nested = [to_azure_message(msg) for msg in messages]
azure_messages = [item for sublist in azure_messages_nested for item in sublist]
task: Task[ChatCompletions]
if len(tools) > 0:
if isinstance(tool_choice, Tool):
create_args["tool_choice"] = ChatCompletionsNamedToolChoice(
function=ChatCompletionsNamedToolChoiceFunction(name=tool_choice.name)
)
else:View on GitHub (pinned to 027ecf0a37)
Solutions
- Rename the keys to those in create_kwargs (inspect autogen_ext.models.azure._azure_ai_client.create_kwargs for the exact allowed set)
- Remove arguments that belong to client construction (endpoint, credential, model) from extra_create_args — they go in the constructor
- If a legitimate new SDK param is missing from the whitelist, upgrade autogen-ext or raise an upstream issue
Example fix
# before
await client.create(msgs, extra_create_args={"azure_endpoint": ep, "temperature": 0.2})
# after
await client.create(msgs, extra_create_args={"temperature": 0.2})
# endpoint/credential belong to the constructor, not extra_create_args Defensive patterns
Strategy: validation
Validate before calling
from autogen_ext.models.azure._azure_ai_client import create_kwargs
extra = {k: v for k, v in extra.items() if k in create_kwargs}
bad = set(extra) - create_kwargs # should be empty before calling create() Prevention
- Filter shared kwargs dicts through create_kwargs before passing them
- Constructor options (endpoint/credential/model) never belong in extra_create_args
- Pin autogen-ext and the azure SDK together in lockstep
When it happens
Trigger: Calling create(..., extra_create_args={'azure_endpoint': ..., 'deployment_name': ...}) or vendor-specific options like 'response_format_type', 'seed' (if not whitelisted), 'top_p' spelled differently than in create_kwargs.
Common situations: Porting kwargs from the raw azure-ai-inference SDK or the Azure OpenAI SDK; passing OpenAI-style parameter names; version drift where newer SDK params are not yet in autogen-ext's create_kwargs set.
Related errors
- BING_API_KEY environment variable is not set
- Please set AZURE_OPENAI_API_KEY environment variable.
- Please set AZURE_OPENAI_ENDPOINT environment variable.
- Please set environment variable AZURE_OPENAI_API_KEY
- Dependencies for AzureAIAgent not found. Please install auto
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/2e8e7a432f882175.
Report an issue: GitHub.