microsoft/semantic-kernel · error · ArgumentException
Unsupported parameter type: {typeString}
Error message
Unsupported parameter type: {typeString} What it means
Thrown by the type-mapping switch in BedrockFunctionSchemaExtensions when a .NET parameter type string does not match any supported Bedrock type. The supported set includes primitives (String, Boolean, numeric types) and their array forms. Any other type string (objects, custom classes, unsupported arrays, dictionaries) hits the default arm and throws.
Source
Thrown at dotnet/src/Agents/Bedrock/Extensions/BedrockFunctionSchemaExtensions.cs:99
"Int32" => Amazon.BedrockAgent.Type.Integer,
"UInt32" => Amazon.BedrockAgent.Type.Integer,
"Int64" => Amazon.BedrockAgent.Type.Integer,
"UInt64" => Amazon.BedrockAgent.Type.Integer,
"Single" => Amazon.BedrockAgent.Type.Number,
"Double" => Amazon.BedrockAgent.Type.Number,
"Decimal" => Amazon.BedrockAgent.Type.Number,
"String[]" => Amazon.BedrockAgent.Type.Array,
"Boolean[]" => Amazon.BedrockAgent.Type.Array,
"Int16[]" => Amazon.BedrockAgent.Type.Array,
"UInt16[]" => Amazon.BedrockAgent.Type.Array,
"Int32[]" => Amazon.BedrockAgent.Type.Array,
"UInt32[]" => Amazon.BedrockAgent.Type.Array,
"Int64[]" => Amazon.BedrockAgent.Type.Array,
"UInt64[]" => Amazon.BedrockAgent.Type.Array,
"Single[]" => Amazon.BedrockAgent.Type.Array,
"Double[]" => Amazon.BedrockAgent.Type.Array,
"Decimal[]" => Amazon.BedrockAgent.Type.Array,
_ => throw new ArgumentException($"Unsupported parameter type: {typeString}"),
};
}
}
View on GitHub (pinned to c028a0c7dc)
Solutions
- Change the parameter type to a supported primitive (String, Boolean, Int32, Double, etc.) or a supported one-dimensional array (e.g., String[]).
- For complex inputs, accept a JSON string parameter and deserialize inside the function.
Example fix
// before
[KernelFunction]
public string Create(MyCustomObject data) { ... } // unsupported type
// after — accept a primitive and parse
[KernelFunction]
public string Create([Description("JSON object")] string dataJson)
{
var data = JsonSerializer.Deserialize<MyCustomObject>(dataJson);
...
} Defensive patterns
Strategy: type-guard
Validate before calling
static readonly HashSet<string> Supported = new()
{
"String","Boolean","Int32","Int64","Double","Single","Decimal",
"String[]","Boolean[]","Int32[]","Int64[]","Double[]","Single[]","Decimal[]"
};
// before registering the plugin, check each parameter type name against Supported Type guard
static bool IsBedrockSupportedTypeName(string typeName) =>
typeName is "String" or "Boolean" or "Int16" or "UInt16" or "Int32" or "UInt32"
or "Int64" or "UInt64" or "Single" or "Double" or "Decimal"
or "String[]" or "Boolean[]" or "Int16[]" or "UInt16[]" or "Int32[]"
or "UInt32[]" or "Int64[]" or "UInt64[]" or "Single[]" or "Double[]" or "Decimal[]"; Try / catch
try { agent = await bedrockClient.CreateOrUpdateAgentAsync(...); }
catch (ArgumentException ex) when (ex.Message.Contains("Unsupported parameter type"))
{
logger.LogError("A kernel function parameter type is not supported by Bedrock. Use primitives or their arrays.");
throw;
} Prevention
- Use only primitive .NET types or one-dimensional arrays of primitives for Bedrock tool parameters.
- For complex inputs, accept a JSON string parameter and deserialize inside the function.
- Avoid Guid, DateTime, enums, nullable structs, dictionaries, and multidimensional arrays as parameters.
When it happens
Trigger: Defining a kernel function parameter whose .NET type is not in the supported mapping — e.g., a custom class, Dictionary, Guid, DateTime, enum, nullable struct, or a jagged/multidimensional array. The extension extracts the type name as a string and fails to match it.
Common situations: Plugin methods with complex object parameters; using Guid/DateTime/TimeSpan parameters; enums; nullable value types reported as 'Nullable`1'; multidimensional arrays; Dictionary or KeyValuePair parameters.
Related errors
- Invalid parameter type for function {agentToolDefinition.Id}
- The option key '{key}' is required for a Bedrock function pa
- Message role must be either Assistant or User.
- No function results were returned.
- runtimeClient
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/643032280299f7d6.
Report an issue: GitHub.