-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Bug report form
- I have done a basic search of the issue tracker to find any existing issues that are similar.
- I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug
When using nushell as an MCP server, the complete command does not properly capture external command errors. Instead of returning a structured result with stdout, stderr, and exit_code, it throws an error.
How to reproduce
- Start nushell as an MCP server (
nu --mcp) - Use an MCP client (e.g., Claude Code) to run:
let a = (^ls asjhdsakjhds | complete); $a
- The command fails with an error instead of capturing it
Expected behavior
In normal nushell, the above command returns:
{stdout: "", stderr: "ls: cannot access 'asjhdsakjhds': No such file or directory", exit_code: 2}The complete command should swallow the external command error and return the structured result.
Actual behavior
In MCP mode, it throws:
Error: nu::shell::non_zero_exit_code
x External command had a non-zero exit code
Context
This makes it difficult to handle external command errors gracefully in MCP mode. The complete command is specifically designed to capture errors from external commands, but this behavior is broken in the MCP server.
Configuration
Running from main branch (recent commit).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels