The Qwen2-72B-Instruct model tool calling error 400 with "Currently only named tools are supported" #4945

Closed
opened 2026-02-21 18:08:43 -05:00 by yindo · 5 comments
Owner

Originally created by @YvanCheng on GitHub (Aug 7, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.16

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.15

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

like #6793 , It's closed, but I don't think this is the same issue, and the error codes are also different. I upgraded to 0.6.16, but still receive the same issue.

I deployed Dify through Docker and deployed the Qwen2-72B-Struct and GLM-4 models. When using the Agent function, I found that GLM-4 could call Tools normally, but Qwen2 always prompted 400, The error message is as follows:

[openai_api_compatible] Error: API request failed with status code 400: {"object":"error","message":"[{'type': 'value_error', 'loc': ('body',), 'msg': 'Value error, Currently only named tools are supported.', 'input': {'model': 'Qwen2', 'stream': True, 'messages': [{'role': 'system', 'content': '用户输入:\n查询[具体地区]\n的天气情况。'}, {'role': 'user', 'content': '你好'}], 'tool_choice': 'auto', 'tools': [{'type': 'function', 'function': {'name': 'GetCurrentWeather', 'description': 'Get temperature for a specific location', 'parameters': {'type': 'object', 'properties': {'location': {'type': 'string', 'description': 'The city and state to retrieve the weather for'}}, 'required': ['location']}}}], 'user': '9fa31c2a-db1c-406f-b4a3-e9be5b1dcf81'}, 'ctx': {'error': ValueError('Currently only named tools are supported.')}}]","type":"BadRequestError","param":null,"code":400}
agent-error

tools json as follows:

{
"openapi": "3.1.0",
"info": {
"title": "Get weather data",
"description": "Retrieves current weather data for a location.",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://wttr.in"
}
],
"paths": {
"/{location}": {
"get": {
"description": "Get temperature for a specific location",
"operationId": "GetCurrentWeather",
"parameters": [
{
"name": "location",
"in": "path",
"description": "The city and state to retrieve the weather for",
"required": true,
"schema": {
"type": "string"
}
}
],
"deprecated": false
}
}
},
"components": {
"schemas": {}
}
}

At first, I knew that there was a problem with deploying the Qwen2, but Dify was able to call Qwen2 normally, but could not call Tools:
image

✔️ Expected Behavior

call tools normally

Actual Behavior

call tools error

Originally created by @YvanCheng on GitHub (Aug 7, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.16 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.15 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce like #6793 , It's closed, but I don't think this is the same issue, and the error codes are also different. I upgraded to 0.6.16, but still receive the same issue. I deployed Dify through Docker and deployed the Qwen2-72B-Struct and GLM-4 models. When using the Agent function, I found that GLM-4 could call Tools normally, but Qwen2 always prompted 400, The error message is as follows: [openai_api_compatible] Error: API request failed with status code 400: {"object":"error","message":"[{'type': 'value_error', 'loc': ('body',), 'msg': 'Value error, Currently only named tools are supported.', 'input': {'model': 'Qwen2', 'stream': True, 'messages': [{'role': 'system', 'content': '用户输入:\\n查询[具体地区]\\n的天气情况。'}, {'role': 'user', 'content': '你好'}], 'tool_choice': 'auto', 'tools': [{'type': 'function', 'function': {'name': 'GetCurrentWeather', 'description': 'Get temperature for a specific location', 'parameters': {'type': 'object', 'properties': {'location': {'type': 'string', 'description': 'The city and state to retrieve the weather for'}}, 'required': ['location']}}}], 'user': '9fa31c2a-db1c-406f-b4a3-e9be5b1dcf81'}, 'ctx': {'error': ValueError('**Currently only named tools are supported**.')}}]","type":"BadRequestError","param":null,"code":400} ![agent-error](https://github.com/user-attachments/assets/a7c69857-2e31-4b81-b443-5a925d96c3f5) tools json as follows: { "openapi": "3.1.0", "info": { "title": "Get weather data", "description": "Retrieves current weather data for a location.", "version": "v1.0.0" }, "servers": [ { "url": "https://wttr.in" } ], "paths": { "/{location}": { "get": { "description": "Get temperature for a specific location", "operationId": "GetCurrentWeather", "parameters": [ { "name": "location", "in": "path", "description": "The city and state to retrieve the weather for", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } At first, I knew that there was a problem with deploying the Qwen2, but Dify was able to call Qwen2 normally, but could not call Tools: <img width="1370" alt="image" src="https://github.com/user-attachments/assets/b77b4a63-40a5-40d8-8ef2-b3f775a03cbd"> ### ✔️ Expected Behavior call tools normally ### ❌ Actual Behavior call tools error
yindo added the 🐞 bug label 2026-02-21 18:08:43 -05:00
yindo closed this issue 2026-02-21 18:08:43 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 7, 2024):

Hey there, @YvanCheng! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's tackle this issue together!

To resolve the issue where the Qwen2-72B-Instruct model in your self-hosted Dify (version 0.6.16) deployment using Docker returns a 400 error with the message "Currently only named tools are supported" when attempting to call tools, you need to ensure that the tools you are calling are properly named and supported by the model.

The error message indicates that the model only supports named tools. Therefore, you should verify that the tools you are attempting to call are correctly named and recognized by the model.

Here is an example of how you might define a named tool in your configuration:

tools:
  - name: my_tool
    description: "This is a sample tool"
    endpoint: "http://my_tool_endpoint"

Make sure that the tools you are calling in your application match the names defined in your configuration. If the tools are not named or the names do not match, you will encounter the "Currently only named tools are supported" error.

Ensure that your tool calls in the application are using the correct names as defined in the configuration. For example:

response = model.call_tool("my_tool", parameters)

By ensuring that the tools are properly named and the names match in both the configuration and the application, you should be able to resolve the 400 error [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 7, 2024): <!-- Greeting --> Hey there, @YvanCheng! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's tackle this issue together! <!-- Answer --> To resolve the issue where the Qwen2-72B-Instruct model in your self-hosted Dify (version 0.6.16) deployment using Docker returns a 400 error with the message "Currently only named tools are supported" when attempting to call tools, you need to ensure that the tools you are calling are properly named and supported by the model. The error message indicates that the model only supports named tools. Therefore, you should verify that the tools you are attempting to call are correctly named and recognized by the model. Here is an example of how you might define a named tool in your configuration: ```yaml tools: - name: my_tool description: "This is a sample tool" endpoint: "http://my_tool_endpoint" ``` Make sure that the tools you are calling in your application match the names defined in your configuration. If the tools are not named or the names do not match, you will encounter the "Currently only named tools are supported" error. Ensure that your tool calls in the application are using the correct names as defined in the configuration. For example: ```python response = model.call_tool("my_tool", parameters) ``` By ensuring that the tools are properly named and the names match in both the configuration and the application, you should be able to resolve the 400 error <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/siliconflow/llm/qwen2-72b-instruct.yaml)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@YvanCheng commented on GitHub (Aug 8, 2024):

image I did not use YAML format, I used JSON format, and directly referenced the content in the example, which appears to be the recognized operationId as the tool name, without passing in the name
@YvanCheng commented on GitHub (Aug 8, 2024): <img width="231" alt="image" src="https://github.com/user-attachments/assets/3f088f32-c70c-4c9f-afc9-582e00c5cfc3"> I did not use YAML format, I used JSON format, and directly referenced the content in the example, which appears to be the recognized operationId as the tool name, without passing in the name
Author
Owner

@wltj920 commented on GitHub (Aug 27, 2024):

Problem description

I meet the same bug in 0.7.1, when I use vllm to deploy a qwen2-72b model, and config the model in OpenAI-API-compatible, the bug will reappear.

And I test when I use ollama to deploy qwen2-72b model, and config a Ollama model in dify, the bug will disappeared.

Problem check

I found the log in vllm, it said vllm received a request with wrong parameters like this:

[
    {
        "type": "value_error",
        "loc": ("body",),
        "msg": "Value error, Currently only named tools are supported.",
        "input": {
            "model": "gzwy2s",
            "stream": True,
            "messages": [
                {
                    "role": "system",
                    "content": "You are a powerful AI assistent, please help user.\n"
                },
                {
                    "role": "user",
                    "content": "Who are you?"
                }
            ],
            "tool_choice": "auto",
            "tools": [
                {
                    "type": "function",
                    "function": {
                        "name": "VendorSalesDataQA",
                        "description": "A vendor quality assurance tool for sales data.",
                        "parameters": {
                            "type": "object",
                            "properties": {
                                "query": {
                                    "type": "string",
                                    "description": "A question for QA."
                                }
                            },
                            "required": [
                                "query"
                            ]
                        }
                    }
                },
                {
                    "type": "function",
                    "function": {
                        "name": "dataset_512e2889_77d0_460e_8755_a5efe1eed5ac",
                        "description": "useful for when you want to answer queries about the vendor.pdf",
                        "parameters": {
                            "type": "object",
                            "properties": {
                                "query": {
                                    "type": "string",
                                    "description": "Query for the dataset to be used to retrieve the dataset."
                                }
                            },
                            "required": [
                                "query"
                            ]
                        }
                    }
                }
            ],
            "user": "dd56a2db-da80-4050-839c-44728a072a99"
        },
        "ctx": {
            "error": ValueError("Currently only named tools are supported.")
        }
    }
]

Now you can see the problem is "stream": True,a word with a capital letter!!!

@wltj920 commented on GitHub (Aug 27, 2024): ## Problem description I meet the same bug in 0.7.1, when I use vllm to deploy a qwen2-72b model, and config the model in `OpenAI-API-compatible`, the bug will reappear. And I test when I use ollama to deploy qwen2-72b model, and config a `Ollama` model in dify, the bug will disappeared. ## Problem check I found the log in vllm, it said vllm received a request with wrong parameters like this: ```json [ { "type": "value_error", "loc": ("body",), "msg": "Value error, Currently only named tools are supported.", "input": { "model": "gzwy2s", "stream": True, "messages": [ { "role": "system", "content": "You are a powerful AI assistent, please help user.\n" }, { "role": "user", "content": "Who are you?" } ], "tool_choice": "auto", "tools": [ { "type": "function", "function": { "name": "VendorSalesDataQA", "description": "A vendor quality assurance tool for sales data.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "A question for QA." } }, "required": [ "query" ] } } }, { "type": "function", "function": { "name": "dataset_512e2889_77d0_460e_8755_a5efe1eed5ac", "description": "useful for when you want to answer queries about the vendor.pdf", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "Query for the dataset to be used to retrieve the dataset." } }, "required": [ "query" ] } } } ], "user": "dd56a2db-da80-4050-839c-44728a072a99" }, "ctx": { "error": ValueError("Currently only named tools are supported.") } } ] ``` Now you can see the problem is `"stream": True`,a word with a capital letter!!!
Author
Owner

@wltj920 commented on GitHub (Aug 27, 2024):

I try to use the same parameter to request a llm deployed by vllm, the same problem will appear again. @takatost @JohnJyong

@wltj920 commented on GitHub (Aug 27, 2024): I try to use the same parameter to request a llm deployed by `vllm`, the same problem will appear again. @takatost @JohnJyong
Author
Owner

@XUANYUANRuins commented on GitHub (Jun 19, 2025):

Have you resolved this issue? It also occurred in version 1.0.1

@XUANYUANRuins commented on GitHub (Jun 19, 2025): Have you resolved this issue? It also occurred in version 1.0.1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4945