{"record":{"id":"dc9535bd6555f3ad","repo":"run-llama/llama_index","slug":"metadata-must-be-provided","errorCode":null,"errorMessage":"metadata must be provided","messagePattern":"metadata must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/tools/function_tool.py","lineNumber":124,"sourceCode":"        # Determine if the function requires context by inspecting its signature\n        fn_to_inspect = fn or async_fn\n        assert fn_to_inspect is not None\n        sig = inspect.signature(fn_to_inspect)\n        self.requires_context = any(\n            _is_context_param(param.annotation) for param in sig.parameters.values()\n        )\n        self.ctx_param_name = (\n            next(\n                param.name\n                for param in sig.parameters.values()\n                if _is_context_param(param.annotation)\n            )\n            if self.requires_context\n            else None\n        )\n\n        if metadata is None:\n            raise ValueError(\"metadata must be provided\")\n        self._metadata = metadata\n\n        # Handle callback (sync and async)\n        self._callback = None\n        if callback is not None:\n            self._callback = callback\n        elif async_callback is not None:\n            self._callback = async_to_sync(async_callback)\n\n        self._async_callback = None\n        if async_callback is not None:\n            self._async_callback = async_callback\n        elif self._callback is not None:\n            self._async_callback = sync_to_async(self._callback)\n\n        self.partial_params = partial_params or {}\n\n        # Extract actual default values from FieldInfo defaults so they are","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/tools/function_tool.py#L106-L142","documentation":"Error \"metadata must be provided\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/tools/function_tool.py:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide metadata (ToolMetadata) for the tool.","Use FunctionTool.from_defaults which derives metadata from the function signature."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}