Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
I am a user of Cursor and I’ve encountered a consistent issue when using a Custom Model via the OpenAI-compatible API setting.
Issue Description: When using a custom model (configured with a custom OpenAI Base URL), the request occasionally fails with a 400 Bad Request error. The root cause is that Cursor sends an assistant message containing an empty tool_calls array, which certain API providers/gateways reject.
Error Details:
JSON
{
“error”: {
“message”: “Invalid ‘messages[4].tool_calls’: empty array. Expected an array with minimum length 1, but got an empty array instead.”,
“type”: “invalid_request_error”,
“param”: “messages[4].tool_calls”,
“code”: “empty_array”
}
}
Technical Analysis: It appears that the Cursor client includes “tool_calls”: in the message history when no tools are actually being called. According to the strict interpretation of some OpenAI-compatible schemas, if the tool_calls field is present, it must contain at least one tool call object. Providing an empty list triggers a validation error.
My Configuration:
• OpenAI Base URL: [My Custom URL]
• Model Name: xxx (OpenAI-compatible)
Suggested Fix: In the outgoing API request payload, please ensure that the tool_calls field is either omitted or set to null if there are no tool calls to report, rather than sending an empty array . This would improve compatibility with a wider range of third-party OpenAI-compatible backends.
I love using Cursor and hope this technical feedback helps improve the product. Looking forward to your response.
Best regards,
Steps to Reproduce
use custom model
Operating System
Windows 10/11
Current Cursor Version (Menu → About Cursor → Copy)
Version: 2.2.29 (system setup)
VSCode Version: 1.105.1
Commit: 656af3704923280dedba3ccd49cfaf9b9d456e90
Date: 2025-12-17T03:49:27.355Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.19041
For AI issues: which model did you use?
Custom Model
For AI issues: add Request ID with privacy disabled
Request ID: 312fcc16-18cb-4ca1-9f1a-f70e4b070a55
{“error”:“ERROR_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:“We encountered an issue when using your API key: Provider was unable to process your request\n\nAPI Error:\n\n\nRequest failed with status code 400: {\n \"error\": {\n \"message\": \"Invalid 'messages[4].tool_calls': empty array. Expected an array with minimum length 1, but got an empty array instead.\",\n \"type\": \"invalid_request_error\",\n \"param\": \"messages[4].tool_calls\",\n \"code\": \"empty_array\"\n }\n}\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor