jdx/mise · error

registry archive contains too many entries

Error message

registry archive contains too many entries

What it means

To bound memory and CPU during registry archive loading, mise caps the number of archive entries at MAX_REGISTRY_ARCHIVE_ENTRIES (4096). An archive whose entry index reaches this limit is rejected outright as a DoS guard, independent of individual entry sizes.

Solutions

  1. Use the curated registry archive (or strip non-registry files) so the entry count stays under 4096
  2. Split an oversized registry into multiple archives and load them separately if supported
  3. If upstream legitimately outgrew the cap, upgrade mise (the limit may have been raised) or file an issue to raise MAX_REGISTRY_ARCHIVE_ENTRIES

Example fix

// before (repo checkout archive with 12k files)
mise registry-load --archive ./repo-snapshot.tar.gz
// after
mise registry-load --archive ./registry-4096max.tar.gz  # curated entries only
Defensive patterns

Strategy: validation

Validate before calling

const n = await countArchiveEntries(archivePath);
if (n >= 4096) throw new Error(`archive has ${n} entries; mise caps at 4096`);

Try / catch

try { await loadRegistryArchive(path); } catch (e) {
  if (String(e).includes('too many entries')) {
    console.error('Registry archive exceeds the 4096-entry cap; use the curated archive or split it.');
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: Loading a registry archive that contains 4096 or more entries — either a legitimately huge registry release or an archive padded with thousands of small files (test fixtures, docs, images).

Common situations: Upstream registry release that grew beyond the cap; archives built from a repository checkout rather than a curated set of registry files; a malicious/zip-bomb-style archive designed to exhaust resources.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/50e76d39ac5f4158. Report an issue: GitHub.

Appendix: source

Thrown at src/registry.rs:372

            .to_string();
        let mut source = String::new();
        entry.read_to_string(&mut source)?;
        sources.insert(short, source);
    }

    ensure!(
        !sources.is_empty(),
        "archive does not contain registry entries"
    );
    registry_from_sources(sources)
}

fn track_registry_archive_entry(
    index: usize,
    entry_size: u64,
    archive_size: &mut u64,
) -> Result<()> {
    ensure!(
        index < MAX_REGISTRY_ARCHIVE_ENTRIES,
        "registry archive contains too many entries"
    );
    ensure!(
        entry_size <= MAX_REGISTRY_ARCHIVE_ENTRY_SIZE,
        "registry archive entry is too large"
    );
    *archive_size = archive_size
        .checked_add(entry_size)
        .ok_or_else(|| eyre::eyre!("registry archive size overflow"))?;
    ensure!(
        *archive_size <= MAX_REGISTRY_ARCHIVE_SIZE,
        "registry archive is too large"
    );
    Ok(())
}

fn registry_from_sources(sources: BTreeMap<String, String>) -> Result<Registry> {

View on GitHub (pinned to 533346cc37)