BigPizzaV3/CodexPlusPlus · error
provider target discovery task failed
Error message
provider target discovery task failed: {error} What it means
load_provider_sync_targets runs codex_plus_data::load_provider_sync_targets on a blocking thread via tauri::async_runtime::spawn_blocking and awaits its JoinHandle. A JoinError from .await (the blocking task panicked or was cancelled) is mapped into this error; the message wraps the underlying join failure rather than a data-layer error.
Solutions
- Read the wrapped JoinError message — if it reports a panic, fix the panicking code in codex_plus_data::load_provider_sync_targets
- Replace unwrap/expect/indexing panics in the discovery path with Result-based error handling
- Validate/clean provider config files that discovery reads (corrupt entries are a common panic source)
- Retry the command if the cause was transient runtime cancellation during shutdown
Example fix
// before (panic-prone data layer)
let cfg = fs::read_to_string(path).unwrap();
// after
let cfg = fs::read_to_string(path)
.map_err(|e| anyhow::anyhow!("failed to read provider config {path:?}: {e}"))?; Defensive patterns
Strategy: try-catch
Try / catch
match tauri::async_runtime::spawn_blocking(|| codex_plus_data::load_provider_sync_targets(None)).await {
Ok(Ok(targets)) => { /* 正常路径 */ }
Ok(Err(data_err)) => eprintln!("data layer error: {data_err}"),
Err(join_err) => eprintln!("discovery task panicked or was cancelled: {join_err}"),
} Prevention
- Remove unwrap/expect/slicing panics from load_provider_sync_targets and its callees
- Validate provider config files before parsing; corrupt files are a common panic source
- Keep blocking closures pure data-processing so they return Err instead of panicking
- Avoid triggering discovery during app shutdown, when tasks can be cancelled
When it happens
Trigger: tauri::async_runtime::spawn_blocking(|| codex_plus_data::load_provider_sync_targets(None)) resolved to Err(JoinError) — the closure panicked (e.g. unwrapping bad provider data, file IO panic) or the runtime cancelled the task.
Common situations: Corrupt or unexpected provider config files causing a panic inside the data layer, a panic-prone code path (unwrap/expect) in load_provider_sync_targets, or runtime shutdown/cancellation while discovery was in flight.
Related errors
- session index cleanup preview task failed
- session index cleanup task failed
- archived lookup task failed
- export markdown task failed
- Remote Control candidate check failed
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/bee161bc26f0d155.
Report an issue: GitHub.
Appendix: source
Thrown at apps/codex-plus-manager/src-tauri/src/commands.rs:3157
let key = key.trim();
if key.is_empty() { None } else { Some(key) }
}
fn ensure_text_newline(value: &str) -> String {
if value.trim().is_empty() {
String::new()
} else {
format!("{}\n", value.trim_end())
}
}
#[tauri::command]
pub async fn load_provider_sync_targets() -> CommandResult<Value> {
let settings = SettingsStore::default().load().unwrap_or_default();
let result =
tauri::async_runtime::spawn_blocking(|| codex_plus_data::load_provider_sync_targets(None))
.await
.map_err(|error| anyhow::anyhow!("provider target discovery task failed: {error}"));
match result {
Ok(mut targets) => {
let manual = settings
.provider_sync_manual_providers
.iter()
.chain(settings.provider_sync_saved_providers.iter())
.filter_map(|value| {
let trimmed = value.trim();
if trimmed.is_empty() {
None
} else {
Some(trimmed.to_string())
}
})
.collect::<Vec<_>>();
merge_manual_provider_sync_targets(&mut targets, &manual, &settings, None);
ok(
"Provider 同步目标已加载。",View on GitHub (pinned to b1ed92e5e4)