{"record":{"id":"469312a4023b2bf1","repo":"zeroclaw-labs/zeroclaw","slug":"model-probe-failed-for-target-model-provider","errorCode":null,"errorMessage":"Model probe failed for target model_provider","messagePattern":"Model probe failed for target model_provider","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-runtime/src/doctor/mod.rs","lineNumber":672,"sourceCode":"                .unwrap_or_else(|| \"-\".to_string());\n            println!(\n                \"  {:<18} {:<12} {:<8} {}\",\n                model_provider,\n                model_probe_status_label(outcome),\n                models_text,\n                detail\n            );\n        }\n    }\n\n    if auth_count > 0 {\n        println!(\n            \"  💡 Some model_providers need valid API keys/plan access before `/models` can be fetched.\"\n        );\n    }\n\n    if provider_override.is_some() && ok_count == 0 {\n        anyhow::bail!(\"Model probe failed for target model_provider\")\n    }\n\n    Ok(())\n}\n\n/// Function type for fetching context window from provider.\n/// Allows injection of mock fetch for testing.\ntype FetchContextWindowFn = Box<\n    dyn for<'a> Fn(\n            &'a str,\n            &'a zeroclaw_config::schema::ModelProviderConfig,\n        ) -> std::pin::Pin<\n            Box<dyn std::future::Future<Output = Option<usize>> + Send + 'a>,\n        > + Send\n        + Sync,\n>;\n\n/// Update context_window in config.toml from provider /models endpoints.","sourceCodeStart":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-runtime/src/doctor/mod.rs#L654-L690","documentation":"After probing, run_models counts successful targets; when a specific provider override was supplied and ok_count == 0, every probe for that provider failed (auth, endpoint, network, or plan access) and the command exits with this error instead of reporting success. The per-target failure details are printed above the bail, including a hint about API keys/plan access.","triggerScenarios":"Doctor models probe scoped to one provider (--provider <alias>) where the API key is invalid or expired, the endpoint URI is unreachable, or the account cannot list /models.","commonSituations":"Expired or rotated API key not updated in config/env; self-hosted endpoint URL typo; proxy or firewall blocking egress; free-plan accounts that restrict model listing.","solutions":["Check the provider's api_key is set and valid in the daemon's environment","Verify the provider URI is reachable (curl its /models endpoint)","Re-run without the provider filter and read the per-target error lines to isolate the cause","Confirm the account/plan exposes the model-list endpoint"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"let entry = config.providers.models.get(alias)\n    .ok_or_else(|| anyhow::anyhow!(\"unknown provider alias '{alias}'\"))?;\nif entry.api_key.as_deref().map(str::trim).unwrap_or(\"\").is_empty() {\n    anyhow::bail!(\"provider '{alias}' has no api_key set — probes will fail\");\n}","typeGuard":null,"tryCatchPattern":"match zeroclaw_runtime::doctor::run_models(&config, Some(&alias), false, false).await {\n    Err(err) if err.to_string().contains(\"Model probe failed\") => {\n        eprintln!(\"all probes for '{alias}' failed — check api_key, endpoint URI, and network egress\");\n    }\n    other => other?,\n}","preventionTips":["Rotate keys in config before the old one expires, and keep the daemon environment in sync","Smoke-test provider endpoints with a direct curl to /models when probes start failing","Run the unfiltered probe periodically to distinguish provider-wide outages from per-provider key issues"],"tags":["doctor","model-providers","network","api-key"],"backgroundTag":"connectivity-check-failed","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}