aws / aws/amazon-q-developer-cli

bug: Misleading error message: "Error loading global mcp json path" when workspace MCP config fails to load

Open
#3,316 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
439
PR merge metrics
No merged PRs in 30d

Description

### Checks

- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again

### Operating system

Mac OS X

### Expected behaviour

When the workspace MCP configuration file (`.amazonq/mcp.json`) is missing or fails to load, the error message should correctly indicate it's a workspace configuration issue, not a global configuration issue.

### Actual behaviour

When `.amazonq/mcp.json` is missing from the current working directory, Q CLI logs the misleading error message:

Error loading global mcp json path: {error}

This is confusing because the error is actually about the **workspace** MCP config, not the global one.

### Root Cause

In `/crates/chat-cli/src/cli/agent/mod.rs` at line 922, there's a copy-paste error in the error message:

```rust
// Line 919: Loading workspace config
let workspace_mcp_path = directories::chat_legacy_workspace_mcp_config(os)?;
let workspace_mcp_config = match McpServerConfig::load_from_file(os, workspace_mcp_path).await {
Ok(config) => Some(config),
Err(e) => {
// Line 922 - INCORRECT error message
tracing::error!("Error loading global mcp json path: {e}.");
None
},
};
```

The error message should say "workspace mcp json path" since the code is loading the workspace configuration.

### Steps to reproduce

1. Navigate to a directory that doesn't have `.amazonq/mcp.json`
2. Run `q chat`
3. Observe the misleading error message in logs

### Environment

```yaml
[q-details]
version = "1.19.0"
hash = "018fd3ce90193a546de1219163c48a495d4f0ee6"
date = "2025-10-23T22:25:42.533604Z (6d ago)"
variant = "full"

[system-info]
os = "macOS 15.7.1 (24G231)"
chip = "Apple M2 Pro"
total-cores = 12
memory = "32.00 GB"

[environment]
cwd = "/Users/USER/Documents/SongWork"
cli-path = "/Users/USER/Documents/SongWork"
os = "Mac"
shell-path = "/bin/zsh"
shell-version = "5.9"
terminal = "iTerm 2"
install-method = "unknown"

[env-vars]
PATH = "/Users/USER/.local/share/mise/installs/node/22.19.0/bin:/Users/USER/.local/share/mise/installs/python/3.12.7/bin:/Users/USER/.local/share/mise/installs/python/3.11.10/bin:/Users/USER/.local/share/mise/installs/python/3.10.15/bin:/Users/USER/.local/share/mise/installs/python/3.9.20/bin:/Users/USER/.local/share/mise/installs/python/3.8.20/bin:/Users/USER/.local/share/mise/installs/usage/0.8.4/bin:/Users/USER/.local/share/mise/installs/java/corretto-17.0.12.7.1/bin:/Users/USER/.config/smithy-mcp/mcp-servers:/Users/USER/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/USER/.rbenv/shims:/Applications/kdiff3.app/Contents/MacOS/kdiff3:/opt/local/bin:/opt/local/sbin:/Users/USER/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Applications/iTerm.app/Contents/Resources/utilities:/Users/USER/.local/bin:/Users/USER/Library/Application Support/JetBrains/Toolbox/scripts:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Users/USER/.toolbox/bin"
QTERM_SESSION_ID = "3d0b51dd194640539e4fde55f5383519"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.19.0"
Q_USING_ZSH_AUTOSUGGESTIONS = "1"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.googlecode.iterm2"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.