aaif-goose/goose · error
Cannot parse shard total from '{}'
Error message
Cannot parse shard total from '{}' What it means
In resolve_model_spec_full's shard validation: a GGUF sibling was classified as a shard because parse_shard_index found all-digit text before '-of-' (is_shard_file), but parse_shard_total could not parse the text after the last '-of-' as a u32. That happens when the suffix after '-of-' is not a plain number (e.g. 'model-00001-of-latest.gguf') or carries extra trailing segments. Validation aborts before the file list is built.
Source
Thrown at crates/goose-local-inference/src/hf_models.rs:838
};
let total_size = file.size_bytes;
return Ok((
repo_id,
ResolvedModel {
files: vec![file],
total_size,
mmproj,
},
));
}
// Use shards, sorted by filename so shard 1 is first
shard_files.sort_by(|a, b| a.rfilename.cmp(&b.rfilename));
// Validate shard set completeness: every file must parse to the same
// -of-N total, and indices must be contiguous 1..=N.
let expected_total = parse_shard_total(&shard_files[0].rfilename).ok_or_else(|| {
anyhow::anyhow!(
"Cannot parse shard total from '{}'",
shard_files[0].rfilename
)
})?;
if shard_files.len() != expected_total as usize {
bail!(
"Incomplete shard set for '{}' in {}: found {} of {} shards",
quant,
repo_id,
shard_files.len(),
expected_total
);
}
for (i, shard) in shard_files.iter().enumerate() {
let shard_total = parse_shard_total(&shard.rfilename);
if shard_total != Some(expected_total) {
bail!(
"Inconsistent shard totals for '{}' in {}: shard '{}' has total {:?}, expected {}",View on GitHub (pinned to 3810898a74)
Solutions
- Pick a quantization or repo that ships standard 'model-00001-of-00003.gguf' naming, or a single-file (non-sharded) GGUF
- Check the repo's file list on huggingface.co to see which filename breaks the pattern named in the error
- If the repo should work, report the exact filename as a parser edge case
Defensive patterns
Strategy: validation
Validate before calling
// mirror the library's shard-total parser to preflight a repo's filenames
fn shard_total_parses(filename: &str) -> bool {
let stem = filename.rsplit('/').next().unwrap_or(filename).trim_end_matches(".gguf");
stem.rfind("-of-").and_then(|p| stem.get(p + 4..)).and_then(|t| t.parse::<u32>().ok()).is_some()
} Type guard
fn has_standard_shard_naming(filenames: &[String]) -> bool {
filenames.iter().all(|f| !f.contains("-of-") || shard_total_parses(f))
} Try / catch
if err.to_string().starts_with("Cannot parse shard total") {
// repo naming is nonstandard: switch to a repo with model-XXXXX-of-XXXXX.gguf files
// or a single-file quantization; retrying the same spec cannot succeed
} Prevention
- Curate recommended repos and verify their shard naming once, not per-download
- Check the repo file list on huggingface.co before offering a quantization
- Report filenames that match the index heuristic but break the total parser as bugs
When it happens
Trigger: Resolving a quantization whose repo contains GGUF files matching the shard-index heuristic ('-digits-of-') but with a non-numeric or mangled total, e.g. 'model-BF16-00001-of-00002-v2.gguf' or 'model-00001-of-latest.gguf'.
Common situations: Upstream repos with unconventional shard naming; renames or re-uploads that break the 'model-XXXXX-of-XXXXX.gguf' convention; single-file repos accidentally matching the index heuristic.
Related errors
- Invalid model spec '{}': expected format 'user/repo:quantiza
- Invalid repo id '{}': expected owner/name
- Download failed after {} retries: {}
- Failed to download: HTTP {}
- llama.cpp model '{}' is missing a quantization
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/861519be0a23d0e0.
Report an issue: GitHub.