Cursor throws 'MALFORMED_FUNCTION_CALL' when using Gemini 3 Pro or Gemini 3 Flash

Describe the Bug

Cursor keeps throwing in ‘Agent’, ‘Plan’ and ‘Ask mode’ (didn’t try with Debug mode) this ‘MALFORMED_FUNCTION_CALL’ error. I’ve tried prompting it to respect the JSON schema in different ways. That agent thread is pretty much dead and unrecoverable. This leaves work incomplete and also hard to track what’s going on there.

This is so annoying.

Request ID: 7ed2ffb7-742f-4b05-a692-de23968d11da
{“error”:“ERROR_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:“We encountered an issue when using your API key: Gemini early stop\n\nAPI Error:\n\n\nUnexpected gemini finish reason: function_call_filter: MALFORMED_FUNCTION_CALL\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}
ConnectError: [invalid_argument] Error
at aou.$endAiConnectTransportReportError (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12706:475325)
at JXe._doInvokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:23170)
at JXe._invokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:22912)
at JXe._receiveRequest (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:21544)
at JXe._receiveOneMessage (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:20361)
at mMt.value (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:18388)
at Ce._deliver (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:2962)
at Ce.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:3283)
at Gyt.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12691:12156)
at MessagePort. (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:15679:18406)

Steps to Reproduce

Run an Agent in cursor with Gemini 3 Pro / Lite. This exception happens very often 1/20.

Expected Behavior

I expect all function calls produced by any cloud LLM supported to work without interrupting the agent with a terminal exception.

Operating System

MacOS

Version Information

Version: 2.3.35
VSCode Version: 1.105.1
Commit: cf8353edc265f5e46b798bfb276861d0bf3bf120
Date: 2026-01-13T07:39:18.564Z (1 wk ago)
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

For AI issues: which model did you use?

Gemini 3 Pro, Gemini 3 Lite

For AI issues: add Request ID with privacy disabled

Request ID: 0ffbdd58-81c6-4949-b0f3-c586f66fbc44
{“error”:“ERROR_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:“We encountered an issue when using your API key: Gemini early stop\n\nAPI Error:\n\n\nUnexpected gemini finish reason: function_call_filter: MALFORMED_FUNCTION_CALL\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}

————————–

Request ID: 7ed2ffb7-742f-4b05-a692-de23968d11da
{“error”:“ERROR_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:“We encountered an issue when using your API key: Gemini early stop\n\nAPI Error:\n\n\nUnexpected gemini finish reason: function_call_filter: MALFORMED_FUNCTION_CALL\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}
ConnectError: [invalid_argument] Error
at aou.$endAiConnectTransportReportError (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12706:475325)
at JXe._doInvokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:23170)
at JXe._invokeHandler (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:22912)
at JXe._receiveRequest (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:21544)
at JXe._receiveOneMessage (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:20361)
at mMt.value (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:13633:18388)
at Ce._deliver (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:2962)
at Ce.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:49:3283)
at Gyt.fire (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:12691:12156)
at MessagePort. (vscode-file://vscode-app/Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:15679:18406)

—————————

Request ID: ec54897d-8037-42e4-95c1-8b55544ec256
{“error”:“ERROR_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:“We encountered an issue when using your API key: Gemini early stop\n\nAPI Error:\n\n\nUnexpected gemini finish reason: function_call_filter: MALFORMED_FUNCTION_CALL\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}

——————–

Request ID: fd05411a-77e0-4b86-8aa3-28c625f5e60b
{“error”:“ERROR_OPENAI”,“details”:{“title”:“Unable to reach the model provider”,“detail”:“We encountered an issue when using your API key: Gemini early stop\n\nAPI Error:\n\n\nUnexpected gemini finish reason: function_call_filter: MALFORMED_FUNCTION_CALL\n”,“additionalInfo”:{},“buttons”:,“planChoices”:},“isExpected”:true}

———————–

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the detailed report. The Request IDs, error frequency, and stack trace really help.

This looks like an issue with how Cursor formats function calls for the Gemini 3 API. Google’s API rejects them as invalid. There’s a similar bug in the backlog (forum discussion), but that one is specific to the MCP context.

For now:

  • Try other models (GPT-5.2, Claude Opus/Sonnet) if you need to work urgently
  • If there’s a pattern for when it breaks (specific prompts, context size, task type), share it here. It’ll help us reproduce it

I’ll update the thread if there’s any news.

I think there are higher occurrences of this error when starting ‘Build’ing an existing plan than when running in Agent mode. Starting from an existing plan produces this error with higher incidence. When this happens the error is inescapable for Gemini models.

1 Like