aaif-goose/goose · warning
provider changed before inventory refresh completed
Error message
provider changed before inventory refresh completed
What it means
A background provider-inventory refresh captured a refresh_identity tied to a provider id, then re-fetched the session's provider and compared names; the session had switched to a different provider before the refresh finished. The refresh aborts so models fetched from the old provider are never stored under the new provider's identity — a consistency guard against a provider-switch race, not a data-loss failure.
Source
Thrown at crates/goose/src/acp/server/dispatch.rs:231
let agent_bg = agent.clone();
let cx_bg = cx.clone();
let session_id_bg = session_id.clone();
tokio::spawn(async move {
let refresh_identity = refresh_job.identity;
let refresh_provider_id = refresh_job.provider_id;
let mut refresh_guard =
agent_bg.provider_inventory.refresh_guard(&refresh_identity);
let provider_result: Result<Arc<dyn Provider>> =
AssertUnwindSafe(async {
let session_agent =
agent_bg.get_session_agent(&session_id_bg.0).await?;
let provider = session_agent
.provider()
.await
.map_err(|e| anyhow::anyhow!(e.to_string()))?;
let provider_name = provider.get_name().to_string();
if provider_name != refresh_provider_id {
return Err(anyhow::anyhow!(
"provider changed before inventory refresh completed"
));
}
Ok(provider)
})
.catch_unwind()
.await
.map_err(|_| {
anyhow::anyhow!("provider inventory refresh task panicked")
})
.and_then(|result| result);
let fetch_result = match provider_result {
Ok(provider) => {
match ensure_refresh_identity_current(
&refresh_provider_id,
&refresh_identity,
)View on GitHub (pinned to 3810898a74)
Solutions
- Treat it as benign: switch providers again or wait — the next refresh for the new provider runs with a fresh identity
- Avoid changing providers repeatedly in quick succession while a model list is loading
- If it persists, check that provider get_name() is stable across calls (custom providers returning dynamic names would trip this guard)
Defensive patterns
Strategy: retry
Try / catch
// guard result is consumed by the refresh task itself:
if let Err(e) = refresh_result {
if e.to_string().contains("provider changed before") {
tracing::debug!(%e, "stale refresh skipped; new refresh already scheduled");
} else {
tracing::warn!(%e, "inventory refresh failed");
}
} Prevention
- Avoid switching providers while a model-list refresh is in flight
- Treat this guard as informational — the new provider's refresh carries fresh data
When it happens
Trigger: The user changes the model/provider in the UI while a recommended-models refresh for the previous provider is still in flight; the check 'provider_name != refresh_provider_id' then trips and the task errors out.
Common situations: Rapid provider switching in the desktop app while background refreshes are pending; flaky network making the original refresh slow enough that the user switches providers meanwhile.
Related errors
- provider inventory refresh task panicked
- provider inventory refresh task panicked
- Message with id ${messageId} not found in current messages
- Cannot update message while prompt is active
- Missing env vars for provider '{provider}': {', '.join(missi
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/4fc158a6f69dbb40.
Report an issue: GitHub.