All Agents broken if OpenRouter is used in v15.0 #7571

Closed
opened 2026-02-21 18:21:14 -05:00 by yindo · 15 comments
Owner

Originally created by @infinitnet on GitHub (Jan 7, 2025).

Originally assigned to: @laipz8200 on GitHub.

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

15.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

v15.0 broke all my Agents that use Sonnet 3.5 through OpenRouter. Whenever a tool is invoked, I get this error:

[openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"type":"error","error":{"type":"invalid_request_error","message":"Requests which include `tool_use` or `tool_result` blocks must define tools."}}', 'provider_name': 'Anthropic'}}

[openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"message":"The toolConfig field must be defined when using toolUse and toolResult content blocks."}', 'provider_name': 'Amazon Bedrock'}}

To reproduce:

  1. Create agent using Sonnet 3.5 through OpenRouter
  2. Add any tool
  3. Get agent to use the tool
  4. Enjoy error

✔️ Expected Behavior

Invoking tools should execute the specific tool - worked just fine in previous versions.

Actual Behavior

Tools are not invoked and instead execution stops with:

[openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"type":"error","error":{"type":"invalid_request_error","message":"Requests which include tool_use or tool_result blocks must define tools."}}', 'provider_name': 'Anthropic'}}

[openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"message":"The toolConfig field must be defined when using toolUse and toolResult content blocks."}', 'provider_name': 'Amazon Bedrock'}}

Originally created by @infinitnet on GitHub (Jan 7, 2025). Originally assigned to: @laipz8200 on GitHub. ### 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 15.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce v15.0 broke all my Agents that use Sonnet 3.5 through OpenRouter. Whenever a tool is invoked, I get this error: ``` [openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"type":"error","error":{"type":"invalid_request_error","message":"Requests which include `tool_use` or `tool_result` blocks must define tools."}}', 'provider_name': 'Anthropic'}} [openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"message":"The toolConfig field must be defined when using toolUse and toolResult content blocks."}', 'provider_name': 'Amazon Bedrock'}} ``` To reproduce: 1. Create agent using Sonnet 3.5 through OpenRouter 2. Add any tool 3. Get agent to use the tool 4. Enjoy error ### ✔️ Expected Behavior Invoking tools should execute the specific tool - worked just fine in previous versions. ### ❌ Actual Behavior Tools are not invoked and instead execution stops with: [openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"type":"error","error":{"type":"invalid_request_error","message":"Requests which include `tool_use` or `tool_result` blocks must define tools."}}', 'provider_name': 'Anthropic'}} [openrouter] Error: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{"message":"The toolConfig field must be defined when using toolUse and toolResult content blocks."}', 'provider_name': 'Amazon Bedrock'}}
yindo added the 🐞 bug label 2026-02-21 18:21:14 -05:00
yindo closed this issue 2026-02-21 18:21:15 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 7, 2025):

The errors you're encountering with Dify version 15.0 when using OpenRouter seem to be related to the configuration of tools in your requests. Specifically, the errors indicate that:

  1. For Anthropic, requests that include tool_use or tool_result blocks must define tools. This suggests that the tools are not being properly defined or recognized in the request.

  2. For Amazon Bedrock, the toolConfig field must be defined when using toolUse and toolResult content blocks. This implies that the configuration for these tools is missing or incomplete.

To resolve these issues, you should ensure that:

  • All tools used in your requests are properly defined and configured. This includes specifying the necessary toolConfig field when using toolUse and toolResult blocks.
  • Verify that the tool definitions are correctly set up in your configuration files or code, especially after upgrading to version 15.0, as there might have been changes affecting how tools are configured or invoked.

If these steps do not resolve the issue, reviewing the specific changes in version 15.0 related to tool configuration and invocation might provide further insights. Unfortunately, I couldn't find specific details on changes in version 15.0 that might affect this, so checking the release notes or documentation updates for version 15.0 could be helpful.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 7, 2025): <!-- Answer --> The errors you're encountering with Dify version 15.0 when using OpenRouter seem to be related to the configuration of tools in your requests. Specifically, the errors indicate that: 1. For Anthropic, requests that include `tool_use` or `tool_result` blocks must define tools. This suggests that the tools are not being properly defined or recognized in the request. 2. For Amazon Bedrock, the `toolConfig` field must be defined when using `toolUse` and `toolResult` content blocks. This implies that the configuration for these tools is missing or incomplete. To resolve these issues, you should ensure that: - All tools used in your requests are properly defined and configured. This includes specifying the necessary `toolConfig` field when using `toolUse` and `toolResult` blocks. - Verify that the tool definitions are correctly set up in your configuration files or code, especially after upgrading to version 15.0, as there might have been changes affecting how tools are configured or invoked. If these steps do not resolve the issue, reviewing the specific changes in version 15.0 related to tool configuration and invocation might provide further insights. Unfortunately, I couldn't find specific details on changes in version 15.0 that might affect this, so checking the release notes or documentation updates for version 15.0 could be helpful. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/a3acdcb4-e041-4913-8adc-523c7bb928bb?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/a3acdcb4-e041-4913-8adc-523c7bb928bb?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/a3acdcb4-e041-4913-8adc-523c7bb928bb?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/a3acdcb4-e041-4913-8adc-523c7bb928bb?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a3acdcb4-e041-4913-8adc-523c7bb928bb?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/a3acdcb4-e041-4913-8adc-523c7bb928bb?feedback_type=other)</sup>
Author
Owner

@yihong0618 commented on GitHub (Jan 7, 2025):

Hi can you provide dsl or screenshot?

@yihong0618 commented on GitHub (Jan 7, 2025): Hi can you provide dsl or screenshot?
Author
Owner

@infinitnet commented on GitHub (Jan 8, 2025):

@yihong0618 See attached. It's really simple to reproduce:

  1. Create agent using Sonnet 3.5 through OpenRouter
  2. Add any tool
  3. Get agent to use the tool
  4. See error
    Screenshot at Jan 08 22-07-59
    Screenshot at Jan 08 22-08-27

DSL:

app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: agent-chat
  name: test agent
  use_icon_as_answer_icon: false
kind: app
model_config:
  agent_mode:
    enabled: false
    prompt: null
    strategy: null
    tools: []
  annotation_reply:
    enabled: false
  chat_prompt_config: {}
  completion_prompt_config: {}
  dataset_configs:
    retrieval_model: multiple
  dataset_query_variable: null
  external_data_tools: []
  file_upload:
    image:
      detail: high
      enabled: false
      number_limits: 3
      transfer_methods:
      - remote_url
      - local_file
  model:
    completion_params: {}
    mode: chat
    name: anthropic/claude-3.5-sonnet
    provider: openrouter
  more_like_this:
    enabled: false
  opening_statement: null
  pre_prompt: null
  prompt_type: simple
  retriever_resource:
    enabled: true
  sensitive_word_avoidance:
    configs: []
    enabled: false
    type: ''
  speech_to_text:
    enabled: false
  suggested_questions: []
  suggested_questions_after_answer:
    enabled: false
  text_to_speech:
    enabled: false
  user_input_form: []
version: 0.1.5
@infinitnet commented on GitHub (Jan 8, 2025): @yihong0618 See attached. It's really simple to reproduce: 1. Create agent using Sonnet 3.5 through OpenRouter 2. Add any tool 3. Get agent to use the tool 4. See error <img width="538" alt="Screenshot at Jan 08 22-07-59" src="https://github.com/user-attachments/assets/0c07011d-aa01-458f-8b21-ff31b6380e4e" /> <img width="1674" alt="Screenshot at Jan 08 22-08-27" src="https://github.com/user-attachments/assets/a1bcce59-b9c5-438e-b2e5-97c7c68bc366" /> DSL: ```` app: description: '' icon: 🤖 icon_background: '#FFEAD5' mode: agent-chat name: test agent use_icon_as_answer_icon: false kind: app model_config: agent_mode: enabled: false prompt: null strategy: null tools: [] annotation_reply: enabled: false chat_prompt_config: {} completion_prompt_config: {} dataset_configs: retrieval_model: multiple dataset_query_variable: null external_data_tools: [] file_upload: image: detail: high enabled: false number_limits: 3 transfer_methods: - remote_url - local_file model: completion_params: {} mode: chat name: anthropic/claude-3.5-sonnet provider: openrouter more_like_this: enabled: false opening_statement: null pre_prompt: null prompt_type: simple retriever_resource: enabled: true sensitive_word_avoidance: configs: [] enabled: false type: '' speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false user_input_form: [] version: 0.1.5 ````
Author
Owner

@fre2d0m commented on GitHub (Jan 8, 2025):

Same error, was it tested before release?

@fre2d0m commented on GitHub (Jan 8, 2025): Same error, was it tested before release?
Author
Owner

@yihong0618 commented on GitHub (Jan 8, 2025):

can not reproduce

can you provide more info?
image

@yihong0618 commented on GitHub (Jan 8, 2025): can not reproduce can you provide more info? ![image](https://github.com/user-attachments/assets/5753eceb-1bb1-427b-93fb-a1bd6b3bddf5)
Author
Owner

@fre2d0m commented on GitHub (Jan 8, 2025):

can not reproduce

can you provide more info?

image

I upgraded from v13 to v15. But there is an error in the tool call. Same as the previous screenshot error

@fre2d0m commented on GitHub (Jan 8, 2025): > can not reproduce > > > > can you provide more info? > > ![image](https://github.com/user-attachments/assets/5753eceb-1bb1-427b-93fb-a1bd6b3bddf5) > > I upgraded from v13 to v15. But there is an error in the tool call. Same as the previous screenshot error
Author
Owner

@zyp512918954 commented on GitHub (Jan 9, 2025):

same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows.
image

@zyp512918954 commented on GitHub (Jan 9, 2025): same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows. ![image](https://github.com/user-attachments/assets/9b91dec3-a82e-4638-816d-8daa6410163a)
Author
Owner

@yihong0618 commented on GitHub (Jan 9, 2025):

same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows. image

sorry I tried as the comment, but I can not reproduce can you provide more detail?

@yihong0618 commented on GitHub (Jan 9, 2025): > same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows. ![image](https://private-user-images.githubusercontent.com/66044059/401812191-9b91dec3-a82e-4638-816d-8daa6410163a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzY0ODQwODMsIm5iZiI6MTczNjQ4Mzc4MywicGF0aCI6Ii82NjA0NDA1OS80MDE4MTIxOTEtOWI5MWRlYzMtYTgyZS00NjM4LTgxNmQtOGRhYTY0MTAxNjNhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTEwVDA0MzYyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ4OTRkMDAwZTVhMWY4NDVhOGI0OTA3YWI0NmY1MTM2MDY0YzNjNmM5YjFlN2RiM2Q3NDk1M2Y5ZTA4OGFiMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.jgNhcB1-Ff_WotMYusZI_V36sQhjiQIAo-95uSf0YxY) sorry I tried as the comment, but I can not reproduce can you provide more detail?
Author
Owner

@zyp512918954 commented on GitHub (Jan 9, 2025):

same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows. image

sorry I tried as the comment, but I can not reproduce can you provide more detail?

How about trying with released version rather than develop environment?
Dify 0.15.0

@zyp512918954 commented on GitHub (Jan 9, 2025): > > same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows. ![image](https://private-user-images.githubusercontent.com/66044059/401812191-9b91dec3-a82e-4638-816d-8daa6410163a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzY0ODQwODMsIm5iZiI6MTczNjQ4Mzc4MywicGF0aCI6Ii82NjA0NDA1OS80MDE4MTIxOTEtOWI5MWRlYzMtYTgyZS00NjM4LTgxNmQtOGRhYTY0MTAxNjNhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTEwVDA0MzYyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ4OTRkMDAwZTVhMWY4NDVhOGI0OTA3YWI0NmY1MTM2MDY0YzNjNmM5YjFlN2RiM2Q3NDk1M2Y5ZTA4OGFiMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.jgNhcB1-Ff_WotMYusZI_V36sQhjiQIAo-95uSf0YxY) > > sorry I tried as the comment, but I can not reproduce can you provide more detail? How about trying with released version rather than develop environment? Dify 0.15.0
Author
Owner

@fre2d0m commented on GitHub (Jan 10, 2025):

same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows. image

sorry I tried as the comment, but I can not reproduce can you provide more detail?

Maybe you can try to upgrade from v13 to v15 instead of the development environment.

@fre2d0m commented on GitHub (Jan 10, 2025): > > same error here, I have defined a workflow as a tool. Right after the workflow return a result, the error shows. ![image](https://private-user-images.githubusercontent.com/66044059/401812191-9b91dec3-a82e-4638-816d-8daa6410163a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzY0ODQwODMsIm5iZiI6MTczNjQ4Mzc4MywicGF0aCI6Ii82NjA0NDA1OS80MDE4MTIxOTEtOWI5MWRlYzMtYTgyZS00NjM4LTgxNmQtOGRhYTY0MTAxNjNhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTEwVDA0MzYyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ4OTRkMDAwZTVhMWY4NDVhOGI0OTA3YWI0NmY1MTM2MDY0YzNjNmM5YjFlN2RiM2Q3NDk1M2Y5ZTA4OGFiMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.jgNhcB1-Ff_WotMYusZI_V36sQhjiQIAo-95uSf0YxY) > > > > sorry I tried as the comment, but I can not reproduce can you provide more detail? Maybe you can try to upgrade from v13 to v15 instead of the development environment.
Author
Owner

@zyp512918954 commented on GitHub (Jan 10, 2025):

image
By the way, same issue could occur when I use openrouter claude 3.5 Haiku route to Anthropic.

@zyp512918954 commented on GitHub (Jan 10, 2025): ![image](https://github.com/user-attachments/assets/57732cbf-f93e-41d7-b70e-02d845a53811) By the way, same issue could occur when I use openrouter claude 3.5 Haiku route to Anthropic.
Author
Owner

@yihong0618 commented on GitHub (Jan 10, 2025):

Thanks for the info will test it on cloud

@yihong0618 commented on GitHub (Jan 10, 2025): Thanks for the info will test it on cloud
Author
Owner

@yihong0618 commented on GitHub (Jan 10, 2025):

yes cloud have this problem, will try to figure out why

@yihong0618 commented on GitHub (Jan 10, 2025): yes cloud have this problem, will try to figure out why
Author
Owner

@yihong0618 commented on GitHub (Jan 10, 2025):

@all

this issue fixed in #12463 you can use the code to check

cc @crazywoola

@yihong0618 commented on GitHub (Jan 10, 2025): @all this issue fixed in #12463 you can use the code to check cc @crazywoola
Author
Owner

@laipz8200 commented on GitHub (Jan 14, 2025):

This issue should be fixed in the 0.15.1 version.

@laipz8200 commented on GitHub (Jan 14, 2025): This issue should be fixed in the 0.15.1 version.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7571