Skip to content

fix: handle missing arguments in MCP tool calls to prevent GUI crash#7143

Merged
DOsinga merged 1 commit intoblock:mainfrom
echoVic:fix/gui-crash-missing-arguments
Feb 13, 2026
Merged

fix: handle missing arguments in MCP tool calls to prevent GUI crash#7143
DOsinga merged 1 commit intoblock:mainfrom
echoVic:fix/gui-crash-missing-arguments

Conversation

@echoVic
Copy link
Contributor

@echoVic echoVic commented Feb 11, 2026

Summary

When a tool request arrives without an arguments field (valid for no-arg tools like MATLAB toolbox detection), the desktop renderer crashes with:

Cannot convert undefined or null to object

Root Cause

In ui/desktop/src/components/ToolCallWithResponse.tsx, the getToolDescription() function casts toolCall.arguments directly without a fallback:

const args = toolCall.arguments as Record<string, ToolCallArgumentValue>;

When arguments is undefined (valid per MCP spec for no-arg tools), the subsequent Object.entries(args) call in the default branch throws.

Fix

Add nullish coalescing default so args safely falls back to an empty object:

const args = (toolCall.arguments ?? {}) as Record<string, ToolCallArgumentValue>;

This is consistent with how the same file already handles arguments elsewhere (e.g., line 469 uses optional chaining, line 815 uses && guard).

Testing

  • No-arg tool calls (e.g. matlab__detect_matlab_toolboxes) now render without crashing
  • Tools with arguments continue to work as before (all existing switch cases access args.* properties which safely return undefined on an empty object)

Fixes #7116

When a tool request arrives without an arguments field (valid for no-arg
tools like MATLAB toolbox detection), the desktop renderer crashes with
'Cannot convert undefined or null to object' because Object.entries()
is called on undefined.

Add nullish coalescing default (?? {}) so args safely falls back to an
empty object.

Fixes block#7116

Signed-off-by: 青雲 <137844255@qq.com>
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof this code could do with some cleanup, but thanks for the fix!

@DOsinga
Copy link
Collaborator

DOsinga commented Feb 12, 2026

can you take care of the DCO thing so we can merge?

@echoVic echoVic force-pushed the fix/gui-crash-missing-arguments branch from 1a021bd to 491c8a0 Compare February 13, 2026 04:36
@echoVic
Copy link
Contributor Author

echoVic commented Feb 13, 2026

Done! I've amended the commit with the DCO sign-off. Should be good to merge now. 🙏

@DOsinga
Copy link
Collaborator

DOsinga commented Feb 13, 2026

thank you!

@DOsinga DOsinga added this pull request to the merge queue Feb 13, 2026
Merged via the queue into block:main with commit 7c253e6 Feb 13, 2026
19 checks passed
jh-block added a commit that referenced this pull request Feb 13, 2026
* origin/main:
  fix: allow concurrent tool execution within the same MCP extension (#7202)
  fix: handle missing arguments in MCP tool calls to prevent GUI crash (#7143)
  Filter Apps page to only show standalone Goose Apps (#6811)
  opt: use static for Regex (#7205)
katzdave added a commit that referenced this pull request Feb 13, 2026
…ntext

* 'main' of github.com:block/goose:
  feat: add onFallbackRequest handler to McpAppRenderer (#7208)
  feat: add streaming support for Claude Code CLI provider (#6833)
  fix: The detected filetype is PLAIN_TEXT, but the provided filetype was HTML (#6885)
  Add prompts (#7212)
  Add testing instructions for speech to text (#7185)
  Diagnostic files copying (#7209)
  fix: allow concurrent tool execution within the same MCP extension (#7202)
  fix: handle missing arguments in MCP tool calls to prevent GUI crash (#7143)
  Filter Apps page to only show standalone Goose Apps (#6811)
  opt: use static for Regex (#7205)
  nit: show dir in title, and less... jank (#7138)
  feat(gemini-cli): use stream-json output and re-use session (#7118)
  chore(deps): bump qs from 6.14.1 to 6.14.2 in /documentation (#7191)
  Switch jsonwebtoken to use aws-lc-rs (already used by rustls) (#7189)
  chore(deps): bump qs from 6.14.1 to 6.14.2 in /evals/open-model-gym/mcp-harness (#7184)
  Add SLSA build provenance attestations to release workflows (#7097)
  fix save and run recipe not working (#7186)
  Upgraded npm packages for latest security updates (#7183)
  docs: reasoning effort levels for Codex provider (#6798)
michaelneale added a commit that referenced this pull request Feb 16, 2026
* origin/main: (42 commits)
  fix: use dynamic port for Tetrate auth callback server (#7228)
  docs: removing LLM Usage admonitions (#7227)
  feat(otel): respect standard OTel env vars for exporter selection (#7144)
  fix: fork session (#7219)
  Bump version numbers for 1.24.0 release (#7214)
  Move platform extensions into their own folder (#7210)
  fix: ignore deprecated skills extension (#7139)
  Add a goosed over HTTP integration test, and test the developer tool PATH (#7178)
  feat: add onFallbackRequest handler to McpAppRenderer (#7208)
  feat: add streaming support for Claude Code CLI provider (#6833)
  fix: The detected filetype is PLAIN_TEXT, but the provided filetype was HTML (#6885)
  Add prompts (#7212)
  Add testing instructions for speech to text (#7185)
  Diagnostic files copying (#7209)
  fix: allow concurrent tool execution within the same MCP extension (#7202)
  fix: handle missing arguments in MCP tool calls to prevent GUI crash (#7143)
  Filter Apps page to only show standalone Goose Apps (#6811)
  opt: use static for Regex (#7205)
  nit: show dir in title, and less... jank (#7138)
  feat(gemini-cli): use stream-json output and re-use session (#7118)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Goose Desktop GUI crashes on MCP tool call when toolRequest.toolCall.value.arguments is missing

2 participants

Comments