Run failed: [google] Error: The user prompt message is required. You only add a system prompt message. #7467

Closed
opened 2026-02-21 18:20:44 -05:00 by yindo · 2 comments
Owner

Originally created by @toptalentsgpt on GitHub (Dec 30, 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.14.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

{
"model_mode": "chat",
"prompts": [
{
"role": "system",
"text": "xml\n<instruction>\n请根据输入的技术需求内容,提炼出用于检索的技术关键词。\n\n**步骤:**\n\n1. 仔细阅读输入的需求内容,理解其核心意图和目标。\n2. 识别出需求内容中涉及的关键技术领域、概念、方法或工具。\n3. 将这些关键技术要素转化为简洁、准确的关键词,并确保关键词能够有效地反映需求内容的本质。\n4. 输出提炼出的技术关键词,每个关键词之间用空格隔开。\n\n**注意:**\n\n* 输出结果中不要包含任何 XML 标签。\n* 关键词应尽量简洁明了,避免使用过于笼统或模糊的词语。\n* 关键词应与需求内容密切相关,能够准确地反映需求内容的主题。\n\n**示例:**\n\n<example>\n**输入:** 我需要一个能够自动识别图片中人物表情的系统。\n**输出:** 人脸识别 表情识别 图像处理 深度学习\n</example>\n\n<example>\n**输入:** 我想开发一个基于自然语言处理的智能客服系统。\n**输出:** 自然语言处理 智能客服 机器学习 语义理解\n</example>\n\n<example>\n**输入:** 我需要一个能够实时监测网络流量的工具。\n**输出:** 网络流量监控 网络安全 数据分析 实时监控\n</example>\n</instruction>\n\n\n输入内容如下:生物科技有限公司\n罕见病及抗癌新药研发,公司专注于用基因编辑技术与细胞疗法治疗罕见病以及抗癌\n新药研发及生产,致力于罕见病及抗癌新药的研发和生产。核心技术:公司拥有领先\n的精准基因替换技术,拥有CRISPR/AAV技术平台的知识产权,目前已有6个孤儿药管\n线研发,其中丙酮酸激酶缺乏症已经取得欧盟EMA、FDA孤儿药资格。",
"files": []
}
],
"model_provider": "google",
"model_name": "gemini-2.0-flash-exp"
}

Shows :Run failed: [google] Error: The user prompt message is required. You only add a system prompt message.

image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @toptalentsgpt on GitHub (Dec 30, 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.14.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce { "model_mode": "chat", "prompts": [ { "role": "system", "text": "```xml\n<instruction>\n请根据输入的技术需求内容,提炼出用于检索的技术关键词。\n\n**步骤:**\n\n1. 仔细阅读输入的需求内容,理解其核心意图和目标。\n2. 识别出需求内容中涉及的关键技术领域、概念、方法或工具。\n3. 将这些关键技术要素转化为简洁、准确的关键词,并确保关键词能够有效地反映需求内容的本质。\n4. 输出提炼出的技术关键词,每个关键词之间用空格隔开。\n\n**注意:**\n\n* 输出结果中不要包含任何 XML 标签。\n* 关键词应尽量简洁明了,避免使用过于笼统或模糊的词语。\n* 关键词应与需求内容密切相关,能够准确地反映需求内容的主题。\n\n**示例:**\n\n<example>\n**输入:** 我需要一个能够自动识别图片中人物表情的系统。\n**输出:** 人脸识别 表情识别 图像处理 深度学习\n</example>\n\n<example>\n**输入:** 我想开发一个基于自然语言处理的智能客服系统。\n**输出:** 自然语言处理 智能客服 机器学习 语义理解\n</example>\n\n<example>\n**输入:** 我需要一个能够实时监测网络流量的工具。\n**输出:** 网络流量监控 网络安全 数据分析 实时监控\n</example>\n</instruction>\n```\n\n输入内容如下:生物科技有限公司\n罕见病及抗癌新药研发,公司专注于用基因编辑技术与细胞疗法治疗罕见病以及抗癌\n新药研发及生产,致力于罕见病及抗癌新药的研发和生产。核心技术:公司拥有领先\n的精准基因替换技术,拥有CRISPR/AAV技术平台的知识产权,目前已有6个孤儿药管\n线研发,其中丙酮酸激酶缺乏症已经取得欧盟EMA、FDA孤儿药资格。", "files": [] } ], "model_provider": "google", "model_name": "gemini-2.0-flash-exp" } Shows :Run failed: [google] Error: The user prompt message is required. You only add a system prompt message. ![image](https://github.com/user-attachments/assets/1c684230-dddd-4464-904d-5cb00e21da16) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:20:44 -05:00
yindo closed this issue 2026-02-21 18:20:44 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 30, 2024):

To resolve the error "Run failed: [google] Error: The user prompt message is required. You only add a system prompt message" in your self-hosted Dify setup, you need to include a user prompt message in your prompt configuration. The error occurs because the model expects at least one message with the role "user" in the prompt messages.

Here's how you can structure your prompt messages to include a UserPromptMessage:

{
  "model_mode": "chat",
  "prompts": [
    {
      "role": "user",
      "text": "Your user prompt here"
    },
    {
      "role": "system",
      "text": "```xml\n<instruction>\n请根据输入的技术需求内容,提炼出用于检索的技术关键词。\n\n**步骤:**\n\n1. 仔细阅读输入的需求内容,理解其核心意图和目标。\n2. 识别出需求内容中涉及的关键技术领域、概念、方法或工具。\n3. 将这些关键技术要素转化为简洁、准确的关键词,并确保关键词能够有效地反映需求内容的本质。\n4. 输出提炼出的技术关键词,每个关键词之间用空格隔开。\n\n**注意:**\n\n* 输出结果中不要包含任何 XML 标签。\n* 关键词应尽量简洁明了,避免使用过于笼统或模糊的词语。\n* 关键词应与需求内容密切相关,能够准确地反映需求内容的主题。\n\n**示例:**\n\n<example>\n**输入:** 我需要一个能够自动识别图片中人物表情的系统。\n**输出:** 人脸识别 表情识别 图像处理 深度学习\n</example>\n\n<example>\n**输入:** 我想开发一个基于自然语言处理的智能客服系统。\n**输出:** 自然语言处理 智能客服 机器学习 语义理解\n</example>\n\n<example>\n**输入:** 我需要一个能够实时监测网络流量的工具。\n**输出:** 网络流量监控 网络安全 数据分析 实时监控\n</example>\n</instruction>\n```\n\n输入内容如下:生物科技有限公司\n罕见病及抗癌新药研发,公司专注于用基因编辑技术与细胞疗法治疗罕见病以及抗癌\n新药研发及生产,致力于罕见病及抗癌新药的研发和生产。核心技术:公司拥有领先\n的精准基因替换技术,拥有CRISPR/AAV技术平台的知识产权,目前已有6个孤儿药管\n线研发,其中丙酮酸激酶缺乏症已经取得欧盟EMA、FDA孤儿药资格。"
    }
  ],
  "model_provider": "google",
  "model_name": "gemini-2.0-flash-exp"
}

Make sure to replace "Your user prompt here" with the actual user input or query you want to process. This should resolve the error by ensuring that the prompt messages include a user role message [1].

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 (Dec 30, 2024): <!-- Answer --> To resolve the error "Run failed: [google] Error: The user prompt message is required. You only add a system prompt message" in your self-hosted Dify setup, you need to include a user prompt message in your prompt configuration. The error occurs because the model expects at least one message with the role "user" in the prompt messages. Here's how you can structure your prompt messages to include a `UserPromptMessage`: ```json { "model_mode": "chat", "prompts": [ { "role": "user", "text": "Your user prompt here" }, { "role": "system", "text": "```xml\n<instruction>\n请根据输入的技术需求内容,提炼出用于检索的技术关键词。\n\n**步骤:**\n\n1. 仔细阅读输入的需求内容,理解其核心意图和目标。\n2. 识别出需求内容中涉及的关键技术领域、概念、方法或工具。\n3. 将这些关键技术要素转化为简洁、准确的关键词,并确保关键词能够有效地反映需求内容的本质。\n4. 输出提炼出的技术关键词,每个关键词之间用空格隔开。\n\n**注意:**\n\n* 输出结果中不要包含任何 XML 标签。\n* 关键词应尽量简洁明了,避免使用过于笼统或模糊的词语。\n* 关键词应与需求内容密切相关,能够准确地反映需求内容的主题。\n\n**示例:**\n\n<example>\n**输入:** 我需要一个能够自动识别图片中人物表情的系统。\n**输出:** 人脸识别 表情识别 图像处理 深度学习\n</example>\n\n<example>\n**输入:** 我想开发一个基于自然语言处理的智能客服系统。\n**输出:** 自然语言处理 智能客服 机器学习 语义理解\n</example>\n\n<example>\n**输入:** 我需要一个能够实时监测网络流量的工具。\n**输出:** 网络流量监控 网络安全 数据分析 实时监控\n</example>\n</instruction>\n```\n\n输入内容如下:生物科技有限公司\n罕见病及抗癌新药研发,公司专注于用基因编辑技术与细胞疗法治疗罕见病以及抗癌\n新药研发及生产,致力于罕见病及抗癌新药的研发和生产。核心技术:公司拥有领先\n的精准基因替换技术,拥有CRISPR/AAV技术平台的知识产权,目前已有6个孤儿药管\n线研发,其中丙酮酸激酶缺乏症已经取得欧盟EMA、FDA孤儿药资格。" } ], "model_provider": "google", "model_name": "gemini-2.0-flash-exp" } ``` Make sure to replace `"Your user prompt here"` with the actual user input or query you want to process. This should resolve the error by ensuring that the prompt messages include a user role message <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/google/llm/llm.py)</sup>. <!-- 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/391ad7db-e6d1-4222-9db2-e075aa85ede2?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/391ad7db-e6d1-4222-9db2-e075aa85ede2?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/391ad7db-e6d1-4222-9db2-e075aa85ede2?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/391ad7db-e6d1-4222-9db2-e075aa85ede2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/391ad7db-e6d1-4222-9db2-e075aa85ede2?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/391ad7db-e6d1-4222-9db2-e075aa85ede2?feedback_type=other)</sup>
Author
Owner

@hjlarry commented on GitHub (Dec 30, 2024):

image

This field is required now

@hjlarry commented on GitHub (Dec 30, 2024): ![image](https://github.com/user-attachments/assets/a7f09459-e774-447d-8715-900a940430a2) This field is required now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7467