Hmbown/CodeWhale · error

entries

Error message

entries

What it means

The `stale_bundled_snapshot_still_resolves` test calls `bundled.entries.keys().next().cloned().expect("entries")`, panicking if the compiled-in bundled catalog has zero entries. The bundled catalog must always ship at least one model for the offline fallback to be meaningful, so an empty map is treated as a build/data error.

Solutions

  1. Regenerate or restore the bundled catalog data so it contains at least one entry
  2. Check the build script / codegen that populates `bundled_catalog()` for silent failures
  3. Inspect `bundled_catalog().entries.len()` in a debug print to see why it is empty
  4. If the catalog legitimately can be empty in some build, assert with a skip instead of expect

Example fix

// before
let some_model = bundled.entries.keys().next().cloned().expect("entries");
// after
assert!(!bundled.entries.is_empty(), "bundled catalog must ship entries");
let some_model = bundled.entries.keys().next().cloned().unwrap();
Defensive patterns

Strategy: validation

Validate before calling

let bundled = bundled_catalog();
if bundled.entries.is_empty() {
    panic!("bundled catalog is empty; check the generation step before running resolution tests");
}

Try / catch

let some_model = match bundled.entries.keys().next() {
    Some(k) => k.clone(),
    None => panic!("bundled catalog empty — regenerate catalog data"),
};

Prevention

When it happens

Trigger: Running the test when `bundled_catalog()` returns a `MergedCatalog` with an empty `entries` map — e.g. the bundled catalog generation step produced no models (empty/missing source data, a build script change, or a filtered-out provider list).

Common situations: Regenerating the bundled catalog from a source file that was emptied or renamed; a build script silently failing to embed catalog data; a refactor changing the entries field type so the generator writes elsewhere.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/e31bef612960d8b0. Report an issue: GitHub.

Appendix: source

Thrown at crates/models/src/model_catalog.rs:278

        }
    }

    #[test]
    fn bundled_snapshot_ttl_is_bounded_to_a_month() {
        // A ten-year TTL made staleness unfirable and shipped a frozen list
        // as current (audit A2). Thirty days is the ceiling.
        let bundled = bundled_catalog();
        assert!(
            bundled.ttl_secs <= 2_678_400,
            "bundled ttl_secs {} exceeds 31 days",
            bundled.ttl_secs
        );
    }

    #[test]
    fn stale_bundled_snapshot_still_resolves() {
        let bundled = bundled_catalog();
        let some_model = bundled.entries.keys().next().cloned().expect("entries");
        let past = bundled.fetched_at + Duration::seconds(bundled.ttl_secs as i64 + 60);
        let catalog = MergedCatalog::from_sources(BTreeMap::new(), None, bundled, past);
        assert!(catalog.bundled_stale());
        assert!(
            catalog.resolve(&some_model).is_some(),
            "offline fallback must keep resolving"
        );
    }

    #[test]
    fn bundled_snapshot_parses_and_is_nonempty() {
        let bundled = bundled_catalog();
        assert_eq!(bundled.schema_version, 1);
        assert!(!bundled.entries.is_empty());
        assert_eq!(
            bundled.entries["deepseek-v4-pro"].provenance,
            MetadataProvenance::Bundled
        );

View on GitHub (pinned to 433685b202)