aaif-goose/goose · error

Invalid model spec '{}': expected format 'user/repo:quantiza

Error message

Invalid model spec '{}': expected format 'user/repo:quantization'

What it means

parse_model_spec splits the spec with rsplit_once(':') into (repo_id, quantization). This error fires when there is no colon at all, and - with the same message from the follow-up check - when the quantization after the colon is empty. A separate 'Invalid repo_id' error covers a left side lacking '/'. It is the entry validation for resolve_model_spec_full and the GGUF download path.

Source

Thrown at crates/goose-local-inference/src/hf_models.rs:739

        .map(|s| {
            let quantization = parse_quantization(&s.rfilename);
            let download_url = build_download_url(repo_id, &s.rfilename);
            HfGgufFile {
                filename: s.rfilename,
                size_bytes: s.size.unwrap_or(0),
                quantization,
                download_url,
            }
        })
        .collect();

    Ok(files)
}

/// Parse a model spec like "bartowski/Llama-3.2-1B-Instruct-GGUF:Q4_K_M" into (repo_id, quantization).
pub fn parse_model_spec(spec: &str) -> Result<(String, String)> {
    let (repo_id, quant) = spec.rsplit_once(':').ok_or_else(|| {
        anyhow::anyhow!(
            "Invalid model spec '{}': expected format 'user/repo:quantization'",
            spec
        )
    })?;

    if !repo_id.contains('/') {
        bail!("Invalid repo_id '{}': expected format 'user/repo'", repo_id);
    }

    if quant.is_empty() {
        bail!(
            "Invalid model spec '{}': expected format 'user/repo:quantization'",
            spec
        );
    }

    Ok((repo_id.to_string(), quant.to_string()))
}

View on GitHub (pinned to 3810898a74)

Solutions

  1. Append the quantization suffix, e.g. 'bartowski/Llama-3.2-1B-Instruct-GGUF:Q4_K_M'
  2. Pick a quantization that actually exists in the repo (check the repo's .gguf file list) to avoid the downstream 'No GGUF file with quantization' error
  3. If building the spec programmatically, validate both halves are non-empty before formatting

Example fix

// before
let spec = format!("{}:{}", repo_id, variant_id); // variant_id may be None/empty
let (repo, quant) = parse_model_spec(&spec)?;

// after
let variant = variant_id.context("quantization variant required")?;
anyhow::ensure!(!variant.is_empty(), "quantization variant required");
let (repo, quant) = parse_model_spec(&format!("{}:{}", repo_id, variant))?;
Defensive patterns

Strategy: validation

Validate before calling

// reject bad specs before touching the network
fn spec_ok(spec: &str) -> bool {
    matches!(spec.rsplit_once(':'), Some((repo, q)) if repo.contains('/') && !q.is_empty())
}
anyhow::ensure!(spec_ok(&spec), "model spec must be 'owner/repo:QUANT', got '{spec}'");

Type guard

fn is_valid_model_spec(spec: &str) -> bool {
    match spec.rsplit_once(':') {
        Some((repo, quant)) => repo.contains('/') && !quant.is_empty(),
        None => false,
    }
}

Try / catch

match parse_model_spec(&spec) {
    Err(e) if e.to_string().contains("expected format 'user/repo:quantization'") => {
        // prompt the user for the quantization instead of retrying the same string
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling resolve_model_spec_full (directly or via resolve_local_model_selection / resolve_gguf_model) with 'owner/repo' lacking the ':Q4_K_M' suffix, or with a trailing colon 'owner/repo:'.

Common situations: User-facing model strings typed without the quantization; configs migrated from a format that stored repo and quant separately; trailing-colon strings produced by naive format!("{}:{}", repo, variant) with an empty variant.

Related errors


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