When using the function call strategy with agent nodes in OpenAI's O-series models, may occur "messages[x].role' does not support 'function' with this model" #388

Closed
opened 2026-02-16 10:19:14 -05:00 by yindo · 2 comments
Owner

Originally created by @ccsang on GitHub (Jun 20, 2025).

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 Dify issues & Dify Official Plugins, 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

1.4.2

Plugin version

Dify Agent 策略: 0.0.18 OpenAI: 0.0.28

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Add an agent node in the chatflow or workflow
  2. Select the function call strategy for the agent node
  3. Choose the OpenAI O1 model for the agent model
  4. Add tools to the agent, such as getting the current time and time zone conversion
  5. Write instructions for the agent: "You are a time agent responsible for providing users with various time-related processing. Query the input via sys.query."
  6. Connect the start node, agent node, and direct output node properly.
  7. Click preview, then enter in the input box: "What time is it in Japan now?"

✔️ Error log

Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [models] Bad Request Error, Error code: 400 - {'message': 'Error code: 400 - {'error': {'message': "Unsupported value: 'messages[3].role' does not support 'function' with this model.", 'type': 'invalid_request_error', 'param': 'messages[3].role', 'code': 'unsupported_value'}}', 'retcode': 40000}"}
Originally created by @ccsang on GitHub (Jun 20, 2025). ### 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 [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/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 1.4.2 ### Plugin version Dify Agent 策略: 0.0.18 OpenAI: 0.0.28 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Add an agent node in the chatflow or workflow 2. Select the function call strategy for the agent node 3. Choose the OpenAI O1 model for the agent model 4. Add tools to the agent, such as getting the current time and time zone conversion 5. Write instructions for the agent: "You are a time agent responsible for providing users with various time-related processing. Query the input via sys.query." 6. Connect the start node, agent node, and direct output node properly. 7. Click preview, then enter in the input box: "What time is it in Japan now?" ### ✔️ Error log ```code Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [models] Bad Request Error, Error code: 400 - {'message': 'Error code: 400 - {'error': {'message': "Unsupported value: 'messages[3].role' does not support 'function' with this model.", 'type': 'invalid_request_error', 'param': 'messages[3].role', 'code': 'unsupported_value'}}', 'retcode': 40000}"} ```
yindo added the bug label 2026-02-16 10:19:14 -05:00
yindo closed this issue 2026-02-16 10:19:14 -05:00
Author
Owner

@ccsang commented on GitHub (Jun 20, 2025):

Image
Perhaps the problem is here.

@ccsang commented on GitHub (Jun 20, 2025): ![Image](https://github.com/user-attachments/assets/aceb9d9b-b644-48c0-ab47-49b0fb9ad021) Perhaps the problem is here.
Author
Owner

@dosubot[bot] commented on GitHub (Aug 18, 2025):

Hi, @ccsang. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a 400 Bad Request error in Dify v1.4.2 when using the function call strategy with agent nodes and the OpenAI O1 model.
  • The error is due to the model not supporting the 'function' role in messages.
  • This occurs specifically during chatflows involving time-related tools.
  • You provided a screenshot to help identify the source of the problem.
  • The issue remains unresolved and under investigation.

What's Next:

  • Please let me know if this issue is still relevant with the latest version of dify-official-plugins by commenting here.
  • If I do not hear back within 5 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 18, 2025): Hi, @ccsang. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported a 400 Bad Request error in Dify v1.4.2 when using the function call strategy with agent nodes and the OpenAI O1 model. - The error is due to the model not supporting the 'function' role in messages. - This occurs specifically during chatflows involving time-related tools. - You provided a screenshot to help identify the source of the problem. - The issue remains unresolved and under investigation. **What's Next:** - Please let me know if this issue is still relevant with the latest version of dify-official-plugins by commenting here. - If I do not hear back within 5 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#388