Hmbown/CodeWhale · error · anyhow::Error
one or more MCP servers failed validation
Error message
one or more MCP servers failed validation
What it means
The `codewhale mcp validate` subcommand checks all configured MCP servers and prints each named failure to stderr; when any validation error exists it aborts with this anyhow bail instead of continuing. It is a deliberate fail-loud gate: the config is considered unusable until every server definition passes validation.
Solutions
- Read the per-server lines printed above the bail (`- {name}: {err:#}`) to see exactly which server and why.
- Fix or remove the offending server entry with `codewhale mcp remove <name>` and re-add it correctly.
- Re-run `codewhale mcp validate` until it reports no failures before starting the TUI.
Example fix
// before (config.json)
{"servers": {"fs": {"command": "/usr/local/bin/mcp-fs"}}}
// after (binary actually exists)
{"servers": {"fs": {"command": "/home/user/.local/bin/mcp-fs"}}} Defensive patterns
Strategy: validation
Validate before calling
let ok = std::process::Command::new("codewhale").args(["mcp", "validate"]).status()?.success();
if !ok { eprintln!("fix MCP config before proceeding"); }
Try / catch
match codewhale_mcp::validate_config(&cfg) {
Ok(()) => start_tui(),
Err(e) => eprintln!("MCP validation failed: {e:#}"),
}
Prevention
- Run `codewhale mcp validate` as a CI/setup step after every config edit.
- Add servers only via `codewhale mcp add`, not by hand-editing JSON.
- Keep server commands as absolute paths that exist on the target machine.
When it happens
Trigger: Running `codewhale mcp validate` (or a flow that invokes it) when `errors` collected from validating `cfg.servers` is non-empty — e.g. a server entry has a bad command, missing required fields, or an unresolvable workspace.
Common situations: Hand-editing mcp config JSON with a typo, adding a server via `codewhale mcp add` with an invalid command path, or copying config from another machine where paths/binary names don't exist.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Provide either a command or URL for MCP server
- bundle at is bytes; the limit is bytes
- doctor configuration validation failed; details omitted…
- doctor configuration validation failed; see JSON output
- invalid JSON payload at key
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/700573ec9191dae3.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:10262
println!("Disabled MCP server '{name}'");
Ok(())
}
McpCommand::Validate => {
let mut pool = McpPool::from_config_path_with_workspace_and_plugins(
&config_path,
workspace,
std::sync::Arc::new(plugins.clone()),
)?;
let errors = pool.connect_all().await;
if errors.is_empty() {
println!("MCP config is valid. All enabled servers connected.");
return Ok(());
}
eprintln!("MCP validation failed:");
for (name, err) in errors {
eprintln!(" - {name}: {err:#}");
}
bail!("one or more MCP servers failed validation");
}
McpCommand::AddSelf { name, workspace } => {
let exe_path = std::env::current_exe()
.map_err(|e| anyhow!("Cannot resolve current binary path: {e}"))?;
let exe_str = exe_path.to_string_lossy().to_string();
let mut args = Vec::with_capacity(if workspace.is_some() { 4 } else { 2 });
if let Some(ref ws) = workspace {
args.push("--workspace".to_string());
args.push(ws.clone());
}
args.push("serve".to_string());
args.push("--mcp".to_string());
crate::mcp::mutate_config(&config_path, None, |cfg| {
if cfg.servers.contains_key(&name) {
bail!(
"MCP server '{name}' already exists in {}. Use `codewhale mcp remove {name}` first, or choose a different --name.",View on GitHub (pinned to 73e0f67d83)