microsoft/autogen · error · InvalidOperationException
Parameter name cannot be null
Error message
Parameter name cannot be null
What it means
Error "Parameter name cannot be null" thrown in microsoft/autogen.
Source
Thrown at dotnet/src/AutoGen.AzureAIInference/Extension/FunctionContractExtension.cs:34
/// Convert a <see cref="FunctionContract"/> to a <see cref="FunctionDefinition"/> that can be used in gpt funciton call.
/// </summary>
/// <param name="functionContract">function contract</param>
/// <returns><see cref="FunctionDefinition"/></returns>
public static FunctionDefinition ToAzureAIInferenceFunctionDefinition(this FunctionContract functionContract)
{
var functionDefinition = new FunctionDefinition
{
Name = functionContract.Name,
Description = functionContract.Description,
};
var requiredParameterNames = new List<string>();
var propertiesSchemas = new Dictionary<string, JsonSchema>();
var propertySchemaBuilder = new JsonSchemaBuilder().Type(SchemaValueType.Object);
foreach (var param in functionContract.Parameters ?? [])
{
if (param.Name is null)
{
throw new InvalidOperationException("Parameter name cannot be null");
}
var schemaBuilder = new JsonSchemaBuilder().FromType(param.ParameterType ?? throw new ArgumentNullException(nameof(param.ParameterType)));
if (param.Description != null)
{
schemaBuilder = schemaBuilder.Description(param.Description);
}
if (param.IsRequired)
{
requiredParameterNames.Add(param.Name);
}
var schema = schemaBuilder.Build();
propertiesSchemas[param.Name] = schema;
}
propertySchemaBuilder = propertySchemaBuilder.Properties(propertiesSchemas);View on GitHub (pinned to 027ecf0a37)
Solutions
- Give every parameter of the function a valid name
Example fix
Annotate the method parameter with a non-null name
When it happens
Trigger: Thrown at dotnet/src/AutoGen.AzureAIInference/Extension/FunctionContractExtension.cs:34 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/eb207b0406e8a504.
Report an issue: GitHub.