{"record":{"id":"63f5849e5105873d","repo":"microsoft/semantic-kernel","slug":"type-is-required-to-convert-the-kernel-function-pa","errorCode":null,"errorMessage":"Type is required to convert the kernel function parameter type to bedrock function parameter type.","messagePattern":"Type is required to convert the kernel function parameter type to bedrock function parameter type\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/bedrock/action_group_utils.py","lineNumber":77,"sourceCode":"BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES = {\n    \"string\",\n    \"number\",\n    \"integer\",\n    \"boolean\",\n    \"array\",\n}\n\n\ndef kernel_function_parameter_type_to_bedrock_function_parameter_type(schema_data: dict[str, Any] | None) -> str:\n    \"\"\"Convert the kernel function parameter type to bedrock function parameter type.\"\"\"\n    if schema_data is None:\n        raise ValueError(\n            \"Schema data is required to convert the kernel function parameter type to bedrock function parameter type.\"\n        )\n\n    type_ = schema_data.get(\"type\")\n    if type_ is None:\n        raise ValueError(\n            \"Type is required to convert the kernel function parameter type to bedrock function parameter type.\"\n        )\n\n    if type_ not in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES:\n        raise ValueError(\n            f\"Type {type_} is not allowed in bedrock function parameter type. \"\n            f\"Allowed types are {BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}.\"\n        )\n\n    return type_\n\n\ndef parse_return_control_payload(return_control_payload: dict[str, Any]) -> list[FunctionCallContent]:\n    \"\"\"Parse the return control payload to a list of function call contents for the kernel.\"\"\"\n    return [\n        FunctionCallContent(\n            id=return_control_payload[\"invocationId\"],\n            name=invocation_input[\"functionInvocationInput\"][\"function\"],","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/bedrock/action_group_utils.py#L59-L95","documentation":"Raised by the same Bedrock type converter when schema_data is present but has no 'type' key. The converter only knows how to map an explicit JSON-schema type, so a schema without 'type' (e.g. one containing only a description or $ref) cannot be translated. Thrown as a plain ValueError.","triggerScenarios":"A KernelParameterMetadata whose schema_data dict lacks a 'type' field (e.g. {'description': '...'} only); a schema generated from an annotation the generator represented without a top-level type; a manually-built schema missing the type key.","commonSituations":"Parameters described only by description/description metadata; custom schema_data set at registration without the type field; an enum or object annotation that the schema generator emitted as {'enum':[...]} without a type.","solutions":["Ensure schema_data contains a 'type' key with one of: string, number, integer, boolean, array.","When building schema_data manually, always include type (e.g. {'type':'string','description':'...'}).","Use a primitive annotation that yields a typed schema, or map object/enum parameters to 'array'/'string' explicitly."],"exampleFix":"// before\nparam = KernelParameterMetadata(name='q', schema_data={'description':'query'})  // no type\n// after\nparam = KernelParameterMetadata(\n    name='q', schema_data={'type':'string','description':'query'},\n)","handlingStrategy":"validation","validationCode":"ALLOWED = {'string','number','integer','boolean','array'}\ndef validate_bedrock_param_types(function_metadata):\n    for p in function_metadata.parameters:\n        sd = p.schema_data or {}\n        t = sd.get('type')\n        if not t:\n            raise ValueError(f\"parameter '{p.name}' schema_data lacks a 'type'\")\n        if t not in ALLOWED:\n            raise ValueError(f\"parameter '{p.name}' type '{t}' not allowed for Bedrock\")\n    return function_metadata","typeGuard":"ALLOWED = {'string','number','integer','boolean','array'}\ndef param_has_valid_type(param) -> bool:\n    sd = getattr(param, 'schema_data', None) or {}\n    return sd.get('type') in ALLOWED","tryCatchPattern":"try:\n    schema = kernel_function_to_bedrock_function_schema(cfg)\nexcept ValueError as e:\n    if 'Type is required' in str(e):\n        log.error('A parameter schema_data dict is missing the type key')\n    raise","preventionTips":["Always include a 'type' key in schema_data when building parameters manually.","Use primitive annotations so the generated schema carries a type.","Pre-validate each parameter's schema_data type before Bedrock conversion."],"tags":["bedrock","function-schema","type-annotation","configuration","agent-initialization"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}