aaif-goose/goose · error

Unknown local inference backend '{}'

Error message

Unknown local inference backend '{}'

What it means

resolve_local_model_selection() validates an explicit backend_id from a download request. Only "mlx" and "llamacpp" are recognized; anything else bails with 'Unknown local inference backend'. The comparison is exact and case-sensitive. If backend_id is omitted entirely, the function returns Ok(None) and selection falls through to spec-based auto-detection.

Source

Thrown at crates/goose-local-inference/src/management.rs:691

        }
    }
}

fn explicit_model_selection(
    req: &LocalInferenceModelDownloadRequest,
) -> Result<Option<LocalModelSelection>> {
    if let Some(backend_id) = req.backend_id.as_deref() {
        let (repo_id, parsed_variant_id) = hf_models::parse_model_spec(&req.spec)
            .map(|(repo_id, quantization)| (repo_id, Some(quantization)))
            .unwrap_or_else(|_| (req.spec.clone(), None));
        let variant_id = req.variant_id.clone().or(parsed_variant_id);
        match backend_id {
            "mlx" | "llamacpp" => Ok(Some(LocalModelSelection {
                repo_id,
                backend_id: backend_id.to_string(),
                variant_id,
            })),
            _ => anyhow::bail!("Unknown local inference backend '{}'", backend_id),
        }
    } else {
        Ok(None)
    }
}

async fn local_model_id_from_request(
    req: &LocalInferenceModelDownloadRequest,
    selection: Option<&LocalModelSelection>,
) -> Result<String> {
    if let Some(selection) = selection {
        return match selection.backend_id.as_str() {
            "mlx" => Ok(selection.repo_id.clone()),
            "llamacpp" => {
                let quantization = selection.variant_id.as_deref().ok_or_else(|| {
                    anyhow!(
                        "llama.cpp model '{}' is missing a quantization",
                        selection.repo_id

View on GitHub (pinned to 3810898a74)

Solutions

  1. Use exactly "mlx" or "llamacpp" (lowercase) as backend_id.
  2. Omit backend_id to let goose auto-detect from the model spec (returns Ok(None) here).
  3. Remember MLX is macOS-only; on Linux/Windows choose "llamacpp".
  4. Trim/normalize user input before constructing the request.

Example fix

// before
let req = DownloadRequest { spec: "Qwen/Qwen2.5-7B:Q4_K_M".into(), backend_id: Some("llama.cpp".into()), ..Default::default() };
// -> Unknown local inference backend 'llama.cpp'

// after
let req = DownloadRequest { spec: "Qwen/Qwen2.5-7B:Q4_K_M".into(), backend_id: Some("llamacpp".into()), ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_BACKENDS: &[&str] = &["mlx", "llamacpp"];
if let Some(backend) = req.backend_id.as_deref() {
    anyhow::ensure!(
        SUPPORTED_BACKENDS.contains(&backend),
        "backend_id must be one of {SUPPORTED_BACKENDS:?}, got '{backend}'"
    );
}
let selection = resolve_selection(&req).await?;

Type guard

fn is_supported_local_backend(id: &str) -> bool {
    matches!(id, "mlx" | "llamacpp")
}

Try / catch

match download_model(req).await {
    Ok(m) => Ok(m),
    Err(e) if e.to_string().starts_with("Unknown local inference backend") => {
        req.backend_id = None; // retry with auto-detection
        download_model(req).await
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: A download request with backend_id set to an unsupported value: "ollama", "vulkan", "cuda", "llama.cpp" (dot instead of 'llamacpp'), "MLX" (wrong case), or with trailing whitespace. The bail fires before any network call or model resolution.

Common situations: UI dropdown or config template carrying a stale backend name after a rename; scripts copied from other tools' vocabulary (ollama/lmstudio); typo or case mismatch; backend names changing between goose versions.

Related errors


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