jdx/mise · error

dotfile enrollment metadata is too large

Error message

dotfile enrollment metadata is too large

What it means

The dotfile enrollment manifest blob is size-checked while reading it from git; any manifest larger than 4 MiB is rejected. This is a defensive cap so a corrupted or malicious history repository cannot force the parser to load arbitrarily large objects into memory.

Solutions

  1. Restore a manifest under 4 MiB from git history: `git checkout <ref> -- <path>`.
  2. Inspect the blob (`git cat-file -p <blob-id> | wc -c`) to see what inflated it; if it is duplicated JSON, rebuild the manifest by re-enrolling dotfiles.
  3. Remove foreign content accidentally committed at the manifest path and re-commit the real manifest.
  4. If the store is unrecoverable, delete/reinit the dotfile history store and let mise recreate a fresh manifest.

Example fix

// before: inspect oversized blob
git cat-file -p $(git rev-parse HEAD:path/to/manifest) | wc -c  # 9 MB
// after: restore a good version
git log --oneline -- path/to/manifest
git checkout <good-commit> -- path/to/manifest
git commit -m 'restore valid manifest'
Defensive patterns

Strategy: validation

Validate before calling

const MAX_MANIFEST_BYTES = 4 * 1024 * 1024;
export function assertManifestSize(bytes: Uint8Array): void {
  if (bytes.byteLength > MAX_MANIFEST_BYTES) {
    throw new Error(`manifest is ${bytes.byteLength} bytes; max is 4 MiB`);
  }
}

Type guard

function isWithinManifestLimit(size: number): boolean {
  return size <= 4 * 1024 * 1024;
}

Prevention

When it happens

Trigger: read_gix finds the manifest entry in mode 0100644 but `entry.id().header()?.size()` exceeds 4 * 1024 * 1024 bytes — e.g. the blob was overwritten with binary data, a log, or an accidentally committed large file at the manifest path.

Common situations: A crash or bad script concatenated repeated JSON into the manifest; someone committed a snapshot/dump file over the manifest path; a sync tool rewrote the manifest with embedded base64 blobs.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

Thrown at src/system/history/manifest.rs:412

        let Some((mode, oid)) = repo.object_at(tree, PATH)? else {
            return Ok(None);
        };
        if mode != "100644" {
            bail!("dotfile enrollment metadata must be a regular file");
        }
        let bytes = repo.cat_object_bounded(&oid, 4 * 1024 * 1024)?;
        Self::from_bytes(&bytes).map(Some)
    }

    pub(crate) fn read_gix(tree: &gix::Tree<'_>) -> Result<Option<Self>> {
        let Some(entry) = tree.lookup_entry_by_path(PATH)? else {
            return Ok(None);
        };
        if entry.mode().value() != 0o100644 {
            bail!("dotfile enrollment metadata must be a regular file");
        }
        if entry.id().header()?.size() > 4 * 1024 * 1024 {
            bail!("dotfile enrollment metadata is too large");
        }
        let object = entry.object()?;
        Self::from_bytes(&object.data).map(Some)
    }

    fn from_bytes(bytes: &[u8]) -> Result<Self> {
        #[derive(Deserialize)]
        struct FormatHeader {
            format: u64,
        }
        let header: FormatHeader = serde_json::from_slice(bytes)?;
        if header.format != 1 {
            bail!("unsupported dotfile repository format {}", header.format);
        }
        let manifest: Self = serde_json::from_slice(bytes)?;
        manifest.validate()?;
        Ok(manifest)
    }

View on GitHub (pinned to 533346cc37)