aaif-goose/goose · error

Provider not available during recipe creation

Error message

Provider not available during recipe creation

What it means

Thrown during LLM recipe generation when the agent's provider slot is empty: self.provider.lock().await is None at the moment provider.complete() is needed. The agent was never configured with a provider (or was reset/failed to restore one), so the completion call cannot be made. It is a lifecycle error, not a model error.

Source

Thrown at crates/goose/src/agents/agent.rs:3812

        let (messages, issues) = fix_conversation(messages);
        if !issues.is_empty() {
            issues
                .iter()
                .for_each(|issue| tracing::warn!(recipe.conversation.issue = issue));
        }
        let messages = Conversation::new_unvalidated(merge_consecutive_messages_for_request(
            messages.messages().clone(),
        ));

        tracing::debug!(
            "Added recipe prompt to messages, total messages: {}",
            messages.len()
        );

        tracing::info!("Calling provider to generate recipe content");
        let provider = self.provider.lock().await;
        let provider = provider.as_ref().ok_or_else(|| {
            let error = anyhow!("Provider not available during recipe creation");
            tracing::error!("{}", error);
            error
        })?;
        let (result, _usage) = crate::session_context::with_session_id(
            Some(session_id.to_string()),
            provider.complete(&model_config, &system_prompt, messages.messages(), &tools),
        )
        .await
        .map_err(|e| {
            tracing::error!("Provider completion failed during recipe creation: {}", e);
            e
        })?;

        let content = result.as_concat_text();
        tracing::debug!(
            "Provider returned content with {} characters",
            content.len()
        );

View on GitHub (pinned to 3810898a74)

Solutions

  1. Ensure the provider is configured before recipe creation: run 'goose configure' or set GOOSE_PROVIDER, and fix any earlier resume/config errors
  2. In embedded code, call Agent::update_provider (and await initialization) before invoking recipe generation
  3. Check goose logs: an earlier 'Could not configure agent' error is usually the real root cause
Defensive patterns

Strategy: validation

Validate before calling

// Rust — confirm the provider is configured before recipe generation
if agent.provider().await.is_err() {
    // call update_provider / complete configuration first
}

Prevention

When it happens

Trigger: Invoking recipe creation (e.g. /recipe from a conversation) before the agent finished configuration, after a failed restore_provider_from_session, or after provider teardown in tests/embedded usage.

Common situations: Embedding the Agent and calling recipe APIs without awaiting configuration; sessions resumed with the 'missing provider' config errors above; tests constructing a bare Agent without update_provider.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/75794069ec5e0ccb. Report an issue: GitHub.