microsoft/semantic-kernel · error · ValueError
Schema data is required to convert the kernel function param
Error message
Schema data is required to convert the kernel function parameter type to bedrock function parameter type.
What it means
Raised by kernel_function_parameter_type_to_bedrock_function_parameter_type when schema_data is None. Bedrock requires every function parameter to declare a JSON-schema type, and the converter derives it from schema_data, so a None schema cannot be mapped. Thrown as a plain ValueError during Bedrock action-group schema generation.
Source
Thrown at python/semantic_kernel/agents/bedrock/action_group_utils.py:71
# Remove None values from the schema
return {key: value for key, value in schema.items() if value is not None}
# These are the allowed parameter types in bedrock function.
# https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ParameterDetail.html
BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES = {
"string",
"number",
"integer",
"boolean",
"array",
}
def kernel_function_parameter_type_to_bedrock_function_parameter_type(schema_data: dict[str, Any] | None) -> str:
"""Convert the kernel function parameter type to bedrock function parameter type."""
if schema_data is None:
raise ValueError(
"Schema data is required to convert the kernel function parameter type to bedrock function parameter type."
)
type_ = schema_data.get("type")
if type_ is None:
raise ValueError(
"Type is required to convert the kernel function parameter type to bedrock function parameter type."
)
if type_ not in BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES:
raise ValueError(
f"Type {type_} is not allowed in bedrock function parameter type. "
f"Allowed types are {BEDROCK_FUNCTION_ALLOWED_PARAMETER_TYPES}."
)
return type_
View on GitHub (pinned to c028a0c7dc)
Solutions
- Add a JSON-schema-compatible type annotation (str, int, float, bool, list) to the kernel function parameter so schema_data is populated.
- If building KernelParameterMetadata manually, supply schema_data={'type':'string'} (or the appropriate type).
- Filter out parameters without schemas before exposing the function to Bedrock, or provide default schemas.
Example fix
// before
@kernel_function
def search(query): ... // no annotation -> schema_data None
// after
@kernel_function
async def search(self, query: str) -> str: ... // str -> schema_data {'type':'string'} Defensive patterns
Strategy: validation
Validate before calling
def validate_bedrock_params(function_metadata):
for p in function_metadata.parameters:
if p.schema_data is None:
raise ValueError(f"parameter '{p.name}' has no schema_data; add a type annotation")
return function_metadata Type guard
def param_has_schema(param) -> bool:
return getattr(param, 'schema_data', None) is not None Try / catch
from semantic_kernel.agents.bedrock.action_group_utils import kernel_function_to_bedrock_function_schema
try:
schema = kernel_function_to_bedrock_function_schema(cfg)
except ValueError as e:
if 'Schema data is required' in str(e):
log.error('A kernel function parameter lacks a type annotation/schema')
raise Prevention
- Annotate all kernel function parameters with primitive types (str/int/float/bool/list).
- When building KernelParameterMetadata manually, always set schema_data.
- Filter or default parameters that have no schema before Bedrock conversion.
When it happens
Trigger: Registering a kernel function whose parameter has no schema_data (e.g. a parameter with no type annotation or a None schema) and then exposing it to a Bedrock agent; a custom KernelParameterMetadata built without schema_data; a function with a complex/unhandled annotation that produced None schema.
Common situations: Using Python functions with no type hints as kernel functions for a Bedrock agent; a parameter typed as a custom class that the schema generator could not map; dynamic function registration that skipped schema population.
Related errors
- Type is required to convert the kernel function parameter ty
- OpenAPI tool '{spec.id}' is missing required 'specification'
- Tool spec must include a 'type' field.
- Unsupported tool type: {spec.type}
- Client cannot be None
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/9aa024f51a2b1824.
Report an issue: GitHub.