From 73d66ebfcffabed13903f79f81133eb55ee38e3f Mon Sep 17 00:00:00 2001 From: wonrax Date: Tue, 15 Jul 2025 23:26:30 +0700 Subject: [PATCH] fix: improve extension startup error messages with command details (#2694) Co-authored-by: Michael Neale --- crates/mcp-client/src/transport/stdio.rs | 19 ++++++++++++++++--- documentation/docs/troubleshooting.md | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/crates/mcp-client/src/transport/stdio.rs b/crates/mcp-client/src/transport/stdio.rs index 2489af1bfb..afe10e8dc5 100644 --- a/crates/mcp-client/src/transport/stdio.rs +++ b/crates/mcp-client/src/transport/stdio.rs @@ -225,9 +225,22 @@ impl StdioTransport { #[cfg(windows)] command.creation_flags(0x08000000); // CREATE_NO_WINDOW flag - let mut process = command - .spawn() - .map_err(|e| Error::StdioProcessError(e.to_string()))?; + let mut process = command.spawn().map_err(|e| { + let command = command.into_std(); + Error::StdioProcessError(format!( + "Could not run extension command (`{} {}`): {}", + command + .get_program() + .to_str() + .unwrap_or("[invalid command]"), + command + .get_args() + .map(|arg| arg.to_str().unwrap_or("[invalid arg]")) + .collect::>() + .join(" "), + e + )) + })?; let stdin = process .stdin diff --git a/documentation/docs/troubleshooting.md b/documentation/docs/troubleshooting.md index cf99e9b426..8e6efcb647 100644 --- a/documentation/docs/troubleshooting.md +++ b/documentation/docs/troubleshooting.md @@ -172,7 +172,7 @@ When the keyring is disabled, secrets are stored here: Many of the external extensions require a package runner. For example, if you run into an error like this one: ``` -Failed to start extension: {extension name}, "No such file or directory (os error 2)" +Failed to start extension `{extension name}`: Could not run extension command (`{extension command}`): No such file or directory (os error 2) Please check extension configuration for {extension name}. ```