aaif-goose/goose · error
Invalid provider type: {}
Error message
Invalid provider type: {} What it means
ProviderEngine::from_str (used when a declarative provider's engine string is parsed, e.g. from config keys or CLI input) accepts only: 'openai'/'openai_compatible', 'anthropic'/'anthropic_compatible', 'ollama'/'ollama_compatible' — matched after trim + lowercase. Any other string, including near-misses like 'openai-compatible' (hyphen), 'OpenAI Compatible' with an unsupported word, or genuinely unsupported engines like 'azure'/'bedrock'/'google', hits this error.
Source
Thrown at crates/goose-providers/src/declarative.rs:106
#[serde(rename_all = "lowercase")]
pub enum ProviderEngine {
#[serde(alias = "openai_compatible")]
OpenAI,
#[serde(alias = "ollama_compatible")]
Ollama,
#[serde(alias = "anthropic_compatible")]
Anthropic,
}
impl FromStr for ProviderEngine {
type Err = anyhow::Error;
fn from_str(engine: &str) -> Result<Self> {
match engine.trim().to_lowercase().as_str() {
"openai" | "openai_compatible" => Ok(Self::OpenAI),
"anthropic" | "anthropic_compatible" => Ok(Self::Anthropic),
"ollama" | "ollama_compatible" => Ok(Self::Ollama),
_ => Err(anyhow::anyhow!("Invalid provider type: {}", engine)),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DeclarativeProviderConfig {
pub name: String,
pub engine: ProviderEngine,
pub display_name: String,
pub description: Option<String>,
#[serde(default)]
pub api_key_env: String,
pub base_url: String,
pub models: Vec<ModelInfo>,
pub headers: Option<HashMap<String, String>>,
pub timeout_seconds: Option<u64>,
pub supports_streaming: Option<bool>,
#[serde(default = "default_requires_auth")]View on GitHub (pinned to 3810898a74)
Solutions
- Set engine to one of: openai, openai_compatible, anthropic, anthropic_compatible, ollama, ollama_compatible (case-insensitive; underscores not hyphens)
- For OpenAI-API-compatible vendors (Groq, Together, etc.) use a bundled declarative provider or engine 'openai_compatible' with your base_url
- For engines goose genuinely doesn't support, use its dedicated built-in provider instead of the declarative path
Example fix
// before
let engine = ProviderEngine::from_str("openai-compatible")?; // Invalid provider type
// after
let engine = ProviderEngine::from_str("openai_compatible")?; Defensive patterns
Strategy: validation
Validate before calling
const ENGINES: [&str; 6] = ["openai", "openai_compatible", "anthropic", "anthropic_compatible", "ollama", "ollama_compatible"];
fn engine_ok(raw: &str) -> bool {
ENGINES.contains(&raw.trim().to_lowercase().as_str())
} Type guard
fn is_valid_engine(raw: &str) -> bool {
matches!(raw.trim().to_lowercase().as_str(),
"openai" | "openai_compatible" | "anthropic" | "anthropic_compatible" | "ollama" | "ollama_compatible")
} Try / catch
let engine = match ProviderEngine::from_str(&raw_engine) {
Ok(e) => e,
Err(_) if raw_engine.contains('-') => ProviderEngine::from_str(&raw_engine.replace('-', "_"))?,
Err(e) => return Err(e.context(format!("engine '{raw_engine}'; accepted: openai[_compatible], anthropic[_compatible], ollama[_compatible]"))),
}; Prevention
- Validate engine strings at config-load time with the six-value whitelist and fail with the accepted list
- Normalize hyphens to underscores (or vice versa) in your config front-end so users can't typo between styles
- For unsupported vendors, steer users to the dedicated built-in provider instead of a declarative JSON
When it happens
Trigger: A declarative provider JSON or dynamic provider entry whose 'engine' field/value is outside the six accepted strings; engine strings copied from another tool's config that use hyphens or different names; note serde deserialization of the JSON field uses its own aliases, so this FromStr path typically comes from string-typed sources like GOOSE_PROVIDER-style selection.
Common situations: Users hand-write custom provider JSON modeling an API goose has no engine for (Gemini, Bedrock) and assume a generic HTTP engine exists; typos and hyphen/underscore mixups after migrating config between tools.
Related errors
- Failed to parse {}: {}
- Required environment variable {} is not set
- Invalid provider id: provider id cannot be empty
- Invalid provider id: {id}
- Provider '{}' has dynamic_models: false but no static models
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/5e59f2ab2774ede4.
Report an issue: GitHub.