Hmbown/CodeWhale · error · anyhow::Error
doctor configuration validation failed; see JSON output
Error message
doctor configuration validation failed; see JSON output
What it means
The `doctor` command validates the configuration and prints a redacted, actionable JSON report on stdout; if validation failed it then bails with this generic message so the process exits non-zero. The generic message is deliberate: the Rust Result termination must never re-print (and risk redisclosing) a secret, so all specifics stay in the redacted JSON.
Solutions
- Read the JSON report doctor printed to stdout — it contains the redacted, actionable validation errors
- Fix each reported config field and rerun `doctor` until validation passes
- Validate the config file syntax (JSON/TOML) and required provider fields
- Restore secrets/keys that were left empty during rotation
Defensive patterns
Strategy: validation
Validate before calling
let report = validate_config(&config);
for issue in &report.issues {
eprintln!("config issue: {issue}");
}
if !report.valid { std::process::exit(1); } Try / catch
// parse the doctor JSON stdout instead of relying on the generic stderr message
let report: DoctorReport = serde_json::from_str(&doctor_stdout)?;
for issue in report.validation_issues { /* act on redacted detail */ } Prevention
- Run `doctor` after every config edit and read its JSON output
- Never rely on the stderr message for details — the JSON report is authoritative and redacted
- Keep secrets out of logged config validation output
When it happens
Trigger: Running `codewhale doctor` when run_doctor's validation produced errors in the report (bad provider settings, missing/invalid keys, malformed config values).
Common situations: After editing a config file with a typo or an invalid provider/model value; rotating API keys and leaving one empty or malformed; copying a config from another machine with environment-specific values.
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
- bundle at is bytes; the limit is bytes
- doctor configuration validation failed; details omitted…
- DS4 /v1/models at did not list configured alias ' '…
- one or more MCP servers failed validation
- Provide either a command or URL for MCP server
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/09e4a79cdb3b6f18.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:6993
/// Emit a bounded, secret-redacted JSON failure when configuration cannot be
/// loaded or validated. Invalid configuration must not be forced through the
/// normal doctor report because its route/capability facts would be misleading.
fn run_doctor_json_config_error(error: &anyhow::Error) -> Result<()> {
let safe_message = error
.downcast_ref::<crate::config::SafeConfigDiagnostic>()
.map(ToString::to_string);
let report = serde_json::json!({
"status": "error",
"error": {
"kind": "config_validation",
"message": safe_message.as_deref().unwrap_or("configuration validation failed; details omitted because configuration errors may contain credential material"),
},
});
println!("{}", serde_json::to_string_pretty(&report)?);
// Keep stderr generic: the actionable, redacted error is already on
// stdout, and Rust's Result termination must never redisclose a secret.
bail!("doctor configuration validation failed; see JSON output")
}
/// Machine-readable counterpart to `run_doctor`. This report is always
/// structural and offline; live probe flags conflict with `--json`.
fn run_doctor_json(
config: &Config,
workspace: &Path,
config_path_override: Option<&Path>,
plugins: &crate::plugins::PluginRegistry,
) -> Result<()> {
use serde_json::json;
let doctor_paths = crate::doctor::DoctorPathReport::resolve(config_path_override)?;
let config_path = &doctor_paths.config;
let secret_backend = codewhale_secrets::diagnose_secret_backend();
let credential = resolve_credential_diagnostic(config);
View on GitHub (pinned to 73e0f67d83)