Skip to content

[Bug]: Azure OpenAI DeepSeek R1 Returns 422 When Using System Prompts #12321

@ehehela

Description

@ehehela

Issue Checklist

  • I understand that issues are for feedback and problem solving, not for complaining in the comment section, and will provide as much information as possible to help solve the problem.
  • My issue is not listed in the FAQ.
  • I've looked at pinned issues and searched for existing Open Issues, Closed Issues, and Discussions, no similar issue or discussion was found.
  • I've filled in short, clear headings so that developers can quickly identify a rough idea of what to expect when flipping through the list of issues. And not "a suggestion", "stuck", etc.
  • I've confirmed that I am using the latest version of Cherry Studio.

Platform

Windows

Version

v1.7.9

Bug Description

When using the Azure OpenAI DeepSeek R1 model, I encountered inconsistent behavior depending on whether the assistant includes a system prompt.

If I use an assistant without any system prompt, the model responds normally.

If I use an assistant with a system prompt added, the API returns a 422 Unprocessable Entity error.

This issue occurs consistently and only when a system prompt is present.

Steps To Reproduce

  1. In the main screen, click "添加助手" and select "默认助手" to create a new assistance.
  2. Go to setting of this "默认助手", set the default model as Azure OpenAI - DeepSeek-R1.
  3. In the chat window, send anything and you will get the response normally.
click to see screenshot Image Image
  1. In the main screen, click "添加助手" and select "默认助手" to create another new assistance.
  2. Go setting of this "默认助手", set the default model as Azure OpenAI - DeepSeek-R1, set the prompt as anything but not empty.
  3. In the chat window, send anything and you will get an error message.
click to see screenshot Image Image

Expected Behavior

The model should return a normal response regardless of whether the assistant includes a system prompt.

Relevant Log Output

错误名称: AI_APICallError
错误信息: invalid input error
堆栈信息: AI_APICallError: invalid input error
    at file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:237803:11
    at async postToApi$2 (file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:237718:24)
    at async OpenAIChatLanguageModel$1.doStream (file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:239443:48)
    at async wrapStream (file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:38715:32)
    at async fn (file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:36906:17)
    at async file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:34293:19
    at async _retryWithExponentialBackoff (file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:34395:10)
    at async streamStep (file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:36874:108)
    at async fn (file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:37153:5)
    at async file:///C:/Users/useruser/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-vioON-rd.js:34293:19
错误原因: "[undefined]"
状态码: 422
请求路径: https://ai-123456789.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview#/openai/deployments/DeepSeek-R1/chat/completions
请求体: {
  "model": "DeepSeek-R1",
  "logit_bias": "[undefined]",
  "logprobs": "[undefined]",
  "top_logprobs": "[undefined]",
  "user": "[undefined]",
  "parallel_tool_calls": "[undefined]",
  "max_tokens": "[undefined]",
  "temperature": "[undefined]",
  "top_p": "[undefined]",
  "frequency_penalty": "[undefined]",
  "presence_penalty": "[undefined]",
  "response_format": "[undefined]",
  "stop": "[undefined]",
  "seed": "[undefined]",
  "verbosity": "[undefined]",
  "max_completion_tokens": "[undefined]",
  "store": false,
  "metadata": "[undefined]",
  "prediction": "[undefined]",
  "reasoning_effort": "[undefined]",
  "service_tier": "[undefined]",
  "prompt_cache_key": "[undefined]",
  "prompt_cache_retention": "[undefined]",
  "safety_identifier": "[undefined]",
  "messages": [
    {
      "role": "developer",
      "content": "you are AI"
    },
    {
      "role": "user",
      "content": "test"
    }
  ],
  "tools": "[undefined]",
  "tool_choice": "[undefined]",
  "stream": true,
  "stream_options": {
    "include_usage": true
  }
}
响应首部: {
  "apim-request-id": "9350a37d-85cf-4880-b40d-af92c7b8fe6f",
  "content-length": "287",
  "content-type": "application/json",
  "date": "Tue, 06 Jan 2026 11:04:41 GMT",
  "document-policy": "include-js-call-stacks-in-crash-reports",
  "ms-azureml-model-error-reason": "model_error",
  "ms-azureml-model-error-statuscode": "422",
  "request-context": "appId=",
  "skip-error-remapping": "true",
  "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
  "x-content-type-options": "nosniff",
  "x-ms-region": "East US 2",
  "x-ratelimit-limit-requests": "20",
  "x-ratelimit-limit-tokens": "20000",
  "x-ratelimit-remaining-requests": "19",
  "x-ratelimit-remaining-tokens": "19984"
}
响应内容: {
  "error": {
    "code": "Invalid input",
    "status": 422,
    "message": "invalid input error",
    "details": [
      {
        "type": "enum",
        "loc": [
          "body",
          "messages",
          0,
          "role"
        ],
        "msg": "Input should be 'system', 'user', 'assistant' or 'tool'",
        "input": "developer",
        "ctx": {
          "expected": "'system', 'user', 'assistant' or 'tool'"
        }
      }
    ]
  }
}
数据: {
  "error": {
    "message": "invalid input error",
    "code": "Invalid input"
  }
}

Additional Context

No response

Metadata

Metadata

Assignees

Labels

BUGCategorizes issue or PR as related to a bugModelsCategorizes an issue or PR as relevant to SIG LLM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions