mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
PluginInvokeError with error code 500 internal server error while using Gemini in agent node #644
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Egoistsoul on GitHub (Sep 12, 2025).
Self Checks
Dify version
1.8.1
Plugin version
0.5.4
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I use Gemini 2.5 Pro in the loop with some tools, and the workflow shutdown and prompt this error:
Run failed: Failed to transform agent message: req_id: 3873f0d022 PluginInvokeError: {"args":{},"error_type":"Exception","message":"invoke llm model failed: request failed with status code: 500 and respond with: {"message":"Internal Server Error","code":"unknown","status":500}\n"}You can check this yml for details build:
B-学习内容生成-test.yml
✔️ Error log
The agent runs properly.
@Egoistsoul commented on GitHub (Sep 12, 2025):
BTW, I already pull the latest code this morning.
@dosubot[bot] commented on GitHub (Sep 12, 2025):
There are still known issues with PluginInvokeError 500 when using Gemini 2.5 Pro in agent nodes, even after recent updates. This error often happens if the agent workflow expects certain keys (like 'search') in the tool/plugin output, but sometimes the Gemini or search tool response is missing them. This causes the workflow to halt with a 500 error, and it's not always fixed by just pulling the latest code—sometimes the plugin or model config needs to be checked, or the containers need a full rebuild/restart for changes to take effect.
Recent plugin updates (>=0.5.1) have improved error handling, file type filtering, and message formatting for Gemini, but intermittent 500 errors can still occur if the workflow logic doesn't defensively check for missing keys in plugin responses. Immediate workarounds include adding retry logic, verifying your tool/plugin configuration, and using fallback/default values for expected keys in your workflow logic. If the error persists, check the plugin daemon logs for more details, as the root cause may be in the plugin or Gemini API response, not Dify core itself. More details and workarounds are discussed here and here.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@Egoistsoul commented on GitHub (Sep 12, 2025):
I believe it has no relevance to the keyword "search".
@dosubot[bot] commented on GitHub (Sep 12, 2025):
The keyword "search" is relevant here only because the agent workflow expects certain keys (like "search") in the tool/plugin output—when these are missing, it triggers a PluginInvokeError 500. This isn't about the literal keyword, but about missing expected fields in the plugin/tool response. The root cause is that the agent node code doesn't defensively check for the existence of these keys before accessing them, so if Gemini or a search tool returns a response without the expected key, you get a KeyError and a 500 error. This is a known issue and is discussed in detail here.
Recent plugin updates have improved error handling and message formatting, but they can't fully prevent this if the upstream API or plugin returns incomplete data. Immediate workarounds are: add retry logic, verify your tool/plugin configuration, and use fallback/default values for expected keys in your workflow logic. If the error persists, check the plugin daemon logs for more details, as the root cause may be in the plugin or Gemini API response, not Dify core itself.
There are ongoing requests for maintainers to add defensive key checks and retry mechanisms in future versions to make agent nodes more robust, especially for multi-tool workflows. For more context and troubleshooting, see this issue.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@Egoistsoul commented on GitHub (Sep 12, 2025):
If the issue truly stems from the key "search," shouldn't it trigger an error message like
"args":{},"error_type":"KeyError","message":"'search'"?However, instead, I received
"args":{},"error_type":"Exception","message":"invoke llm model failed: request failed with status code: 500 and respond with: {"message":"Internal Server Error","code":"unknown","status":500}\n".@dosubot[bot] commented on GitHub (Sep 28, 2025):
Hi, @Egoistsoul. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!
@Egoistsoul commented on GitHub (Oct 19, 2025):
I already update to the latest plugins and these error still occurs:
The error with Openrouter
Failed to transform agent message: req_id: 770e5d7dd5 PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: read tcp 172.30.0.7:33078-\u003e172.30.0.8:5001: use of closed network connection\nfailed to read system header"}
The error with providers Openrouter、OpenAI、 Gemini
Failed to transform agent message: req_id: 38749c1462 PluginInvokeError: {"args":{},"error_type":"Exception","message":"invoke llm model failed: request failed with status code: 500 and respond with: {"message":"Internal Server Error","code":"unknown","status":500}\n"}
@dosubot[bot] commented on GitHub (Oct 19, 2025):
@crazywoola The user reports that after updating to the latest plugins, they still encounter PluginInvokeError 500 Internal Server Errors with Openrouter, OpenAI, and Gemini providers, indicating the issue remains unresolved and needs attention. Could you please assist?
@fengwk commented on GitHub (Oct 22, 2025):
I have a similar problem?
@dosubot[bot] commented on GitHub (Nov 7, 2025):
Hi, @Egoistsoul. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!