I have already upgraded to the latest version of the plugin, and restarting a project to create a new workflow yields the same result. Switching to other models does not cause any issues.
From the pop-up, it seems that your context has not selected an existing “variable value”.
- I did not enable the context feature.
- Even if it were enabled, the error would still occur.
- This issue is not related to context; switching to another model would not cause the error.
@penny Plz add a user message.
@Dify_Forum_Helper Help
Hello! The solution pointed out by @lysonober is completely correct.
This issue is indeed related to the API limitations of the Gemini model, which is why you might not encounter an error when switching to other models (such as the GPT series).
Explanation of the Cause
The error message ValueError: contents are required is an error directly returned by the Google Gemini API.
- Gemini API Mechanism: It strictly requires the request body to include
contents(i.e., the specific list of conversation messages). - Dify Mechanism: In Dify’s LLM node, if you only configure SYSTEM (system prompt) and do not configure USER (user message), or if the USER message content is empty, the request Dify sends to Gemini will be missing the
contentspart. - Difference: Other models (such as OpenAI) might allow sending only a System Prompt or have different handling logic for empty messages, but Gemini is very strict about this, requiring at least one non-empty user message.
Solution
Please follow the instructions in @lysonober’s screenshot:
- In the problematic LLM node, click the “+ Add Message” button at the bottom.
- Set the message type to USER.
- Fill in the variable in the content box (e.g., the
{{input}}variable passed from the “Start” node).
As long as you ensure that the message sent to Gemini includes content in the User part, this error will disappear.
Many thanks!
There’s even a Dify_Forum_Helper, it’s perfect for a technical community.


