{"record":{"id":"643032280299f7d6","repo":"microsoft/semantic-kernel","slug":"unsupported-parameter-type-typestring","errorCode":null,"errorMessage":"Unsupported parameter type: {typeString}","messagePattern":"Unsupported parameter type: (.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Agents/Bedrock/Extensions/BedrockFunctionSchemaExtensions.cs","lineNumber":99,"sourceCode":"            \"Int32\" => Amazon.BedrockAgent.Type.Integer,\n            \"UInt32\" => Amazon.BedrockAgent.Type.Integer,\n            \"Int64\" => Amazon.BedrockAgent.Type.Integer,\n            \"UInt64\" => Amazon.BedrockAgent.Type.Integer,\n            \"Single\" => Amazon.BedrockAgent.Type.Number,\n            \"Double\" => Amazon.BedrockAgent.Type.Number,\n            \"Decimal\" => Amazon.BedrockAgent.Type.Number,\n            \"String[]\" => Amazon.BedrockAgent.Type.Array,\n            \"Boolean[]\" => Amazon.BedrockAgent.Type.Array,\n            \"Int16[]\" => Amazon.BedrockAgent.Type.Array,\n            \"UInt16[]\" => Amazon.BedrockAgent.Type.Array,\n            \"Int32[]\" => Amazon.BedrockAgent.Type.Array,\n            \"UInt32[]\" => Amazon.BedrockAgent.Type.Array,\n            \"Int64[]\" => Amazon.BedrockAgent.Type.Array,\n            \"UInt64[]\" => Amazon.BedrockAgent.Type.Array,\n            \"Single[]\" => Amazon.BedrockAgent.Type.Array,\n            \"Double[]\" => Amazon.BedrockAgent.Type.Array,\n            \"Decimal[]\" => Amazon.BedrockAgent.Type.Array,\n            _ => throw new ArgumentException($\"Unsupported parameter type: {typeString}\"),\n        };\n    }\n}\n","sourceCodeStart":81,"sourceCodeEnd":103,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Agents/Bedrock/Extensions/BedrockFunctionSchemaExtensions.cs#L81-L103","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n[KernelFunction]\npublic string Create(MyCustomObject data) { ... } // unsupported type\n\n// after — accept a primitive and parse\n[KernelFunction]\npublic string Create([Description(\"JSON object\")] string dataJson)\n{\n    var data = JsonSerializer.Deserialize<MyCustomObject>(dataJson);\n    ...\n}","handlingStrategy":"type-guard","validationCode":"static readonly HashSet<string> Supported = new()\n{\n    \"String\",\"Boolean\",\"Int32\",\"Int64\",\"Double\",\"Single\",\"Decimal\",\n    \"String[]\",\"Boolean[]\",\"Int32[]\",\"Int64[]\",\"Double[]\",\"Single[]\",\"Decimal[]\"\n};\n// before registering the plugin, check each parameter type name against Supported","typeGuard":"static bool IsBedrockSupportedTypeName(string typeName) =>\n    typeName is \"String\" or \"Boolean\" or \"Int16\" or \"UInt16\" or \"Int32\" or \"UInt32\"\n        or \"Int64\" or \"UInt64\" or \"Single\" or \"Double\" or \"Decimal\"\n        or \"String[]\" or \"Boolean[]\" or \"Int16[]\" or \"UInt16[]\" or \"Int32[]\"\n        or \"UInt32[]\" or \"Int64[]\" or \"UInt64[]\" or \"Single[]\" or \"Double[]\" or \"Decimal[]\";","tryCatchPattern":"try { agent = await bedrockClient.CreateOrUpdateAgentAsync(...); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Unsupported parameter type\"))\n{\n    logger.LogError(\"A kernel function parameter type is not supported by Bedrock. Use primitives or their arrays.\");\n    throw;\n}","preventionTips":["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."],"tags":["bedrock","agents","tool-definition","type-mapping","validation","csharp"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}