{"record":{"id":"226b62f12f95a34a","repo":"langchain-ai/langchain","slug":"unsupported-function-function-to-use-a-json-sc","errorCode":null,"errorMessage":"Unsupported function\n\n{function}\n\nTo use a JSON schema as a function, it must have a top-level 'title' key to be used as the function name.","messagePattern":"Unsupported function\n\n(.+?)\n\nTo use a JSON schema as a function, it must have a top-level 'title' key to be used as the function name\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/utils/function_calling.py","lineNumber":461,"sourceCode":"            \"dict[str, Any]\",\n            _convert_typed_dict_to_openai_function(cast(\"type\", function)),\n        )\n    elif isinstance(function, langchain_core.tools.base.BaseTool):\n        oai_function = cast(\"dict[str, Any]\", _format_tool_to_openai_function(function))\n    elif callable(function):\n        oai_function = cast(\n            \"dict[str, Any]\", _convert_python_function_to_openai_function(function)\n        )\n    else:\n        if isinstance(function, dict) and (\n            \"type\" in function or \"properties\" in function\n        ):\n            msg = (\n                f\"Unsupported function\\n\\n{function}\\n\\nTo use a JSON schema as a \"\n                \"function, it must have a top-level 'title' key to be used as the \"\n                \"function name.\"\n            )\n            raise ValueError(msg)\n        msg = (\n            f\"Unsupported function\\n\\n{function}\\n\\nFunctions must be passed in\"\n            \" as Dict, pydantic.BaseModel, or Callable. If they're a dict they must\"\n            \" either be in OpenAI function format or valid JSON schema with top-level\"\n            \" 'title' key.\"\n        )\n        raise ValueError(msg)\n\n    if strict is not None:\n        if \"strict\" in oai_function and oai_function[\"strict\"] != strict:\n            msg = (\n                f\"Tool/function already has a 'strict' key with value \"\n                f\"{oai_function['strict']} which is different from the explicit \"\n                f\"`strict` arg received {strict=}.\"\n            )\n            raise ValueError(msg)\n        oai_function[\"strict\"] = strict\n        if strict:","sourceCodeStart":443,"sourceCodeEnd":479,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/utils/function_calling.py#L443-L479","documentation":"Error \"Unsupported function\n\n{function}\n\nTo use a JSON schema as a function, it must have a top-level 'title' key to be used as the function name.\" thrown in langchain-ai/langchain.","triggerScenarios":"Raised when a dict passed as a function to convert_to_openai_function lacks a top-level 'title' key, so no function name can be derived.","commonSituations":"See trigger scenarios.","solutions":["Add a top-level 'title' key to the JSON schema dict so it can be used as the function name.","Alternatively wrap the schema in OpenAI function format: {'type': 'function', 'function': {'name': ..., 'parameters': schema}}."],"exampleFix":"schema = {'title': 'my_func', 'type': 'object', 'properties': {...}}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}