{"record":{"id":"75794069ec5e0ccb","repo":"aaif-goose/goose","slug":"provider-not-available-during-recipe-creation","errorCode":null,"errorMessage":"Provider not available during recipe creation","messagePattern":"Provider not available during recipe creation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose/src/agents/agent.rs","lineNumber":3812,"sourceCode":"        let (messages, issues) = fix_conversation(messages);\n        if !issues.is_empty() {\n            issues\n                .iter()\n                .for_each(|issue| tracing::warn!(recipe.conversation.issue = issue));\n        }\n        let messages = Conversation::new_unvalidated(merge_consecutive_messages_for_request(\n            messages.messages().clone(),\n        ));\n\n        tracing::debug!(\n            \"Added recipe prompt to messages, total messages: {}\",\n            messages.len()\n        );\n\n        tracing::info!(\"Calling provider to generate recipe content\");\n        let provider = self.provider.lock().await;\n        let provider = provider.as_ref().ok_or_else(|| {\n            let error = anyhow!(\"Provider not available during recipe creation\");\n            tracing::error!(\"{}\", error);\n            error\n        })?;\n        let (result, _usage) = crate::session_context::with_session_id(\n            Some(session_id.to_string()),\n            provider.complete(&model_config, &system_prompt, messages.messages(), &tools),\n        )\n        .await\n        .map_err(|e| {\n            tracing::error!(\"Provider completion failed during recipe creation: {}\", e);\n            e\n        })?;\n\n        let content = result.as_concat_text();\n        tracing::debug!(\n            \"Provider returned content with {} characters\",\n            content.len()\n        );","sourceCodeStart":3794,"sourceCodeEnd":3830,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose/src/agents/agent.rs#L3794-L3830","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the provider is configured before recipe creation: run 'goose configure' or set GOOSE_PROVIDER, and fix any earlier resume/config errors","In embedded code, call Agent::update_provider (and await initialization) before invoking recipe generation","Check goose logs: an earlier 'Could not configure agent' error is usually the real root cause"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Rust — confirm the provider is configured before recipe generation\nif agent.provider().await.is_err() {\n    // call update_provider / complete configuration first\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Await full agent configuration before invoking recipe APIs","Fix upstream restore/config errors first — this error is a symptom, not the cause","In tests, always construct the agent with a provider before generating recipes"],"tags":["provider","recipe","lifecycle","initialization"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}