run-llama/llama_index · error · ValueError
metadata must be provided
Error message
metadata must be provided
What it means
Error "metadata must be provided" thrown in run-llama/llama_index.
Source
Thrown at llama-index-core/llama_index/core/tools/function_tool.py:124
# Determine if the function requires context by inspecting its signature
fn_to_inspect = fn or async_fn
assert fn_to_inspect is not None
sig = inspect.signature(fn_to_inspect)
self.requires_context = any(
_is_context_param(param.annotation) for param in sig.parameters.values()
)
self.ctx_param_name = (
next(
param.name
for param in sig.parameters.values()
if _is_context_param(param.annotation)
)
if self.requires_context
else None
)
if metadata is None:
raise ValueError("metadata must be provided")
self._metadata = metadata
# Handle callback (sync and async)
self._callback = None
if callback is not None:
self._callback = callback
elif async_callback is not None:
self._callback = async_to_sync(async_callback)
self._async_callback = None
if async_callback is not None:
self._async_callback = async_callback
elif self._callback is not None:
self._async_callback = sync_to_async(self._callback)
self.partial_params = partial_params or {}
# Extract actual default values from FieldInfo defaults so they areView on GitHub (pinned to afd0fef371)
Solutions
- Provide metadata (ToolMetadata) for the tool.
- Use FunctionTool.from_defaults which derives metadata from the function signature.
When it happens
Trigger: Thrown at llama-index-core/llama_index/core/tools/function_tool.py:124 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/dc9535bd6555f3ad.
Report an issue: GitHub.