jdx/mise · error

too many inherited Git configuration entries

Error message

too many inherited Git configuration entries

What it means

When starting the relay's git session, the relay reads the inherited `GIT_CONFIG_COUNT` environment variable and refuses to proceed if it exceeds 1000, because it must append its own per-index `-c` style config entries and an unbounded inherited count risks breakage and confusion. `parse()` also makes a non-numeric GIT_CONFIG_COUNT an error path.

Solutions

  1. Unset or lower GIT_CONFIG_COUNT in your shell (`unset GIT_CONFIG_COUNT`) before running the relay/git command.
  2. Find what keeps incrementing it (nested direnv/mise hooks, wrapper scripts) and stop stacking configs at each layer.
  3. Consolidate git config into ~/.gitconfig or includeIf files instead of passing hundreds of -c entries via GIT_CONFIG_COUNT.
  4. If it is non-numeric, fix the value to a plain integer to avoid the underlying parse failure.

Example fix

# before (in .zshrc)
export GIT_CONFIG_COUNT=$((GIT_CONFIG_COUNT + 1))
# after
unset GIT_CONFIG_COUNT  # or only set it inside the specific script that needs it
Defensive patterns

Strategy: validation

Validate before calling

const MAX_GIT_CONFIG_COUNT: usize = 1000;
let count: usize = std::env::var("GIT_CONFIG_COUNT").unwrap_or_default().parse().unwrap_or(0);
assert!(count <= MAX_GIT_CONFIG_COUNT, "GIT_CONFIG_COUNT={} too high; unset it before running", count);

Type guard

fn git_config_count_ok() -> bool {
    std::env::var("GIT_CONFIG_COUNT")
        .ok()
        .and_then(|v| v.parse::<usize>().ok())
        .map_or(true, |c| c <= 1000)
}

Prevention

When it happens

Trigger: GIT_CONFIG_COUNT is set to a value greater than 1000 in the parent environment when the relay git session spawns; or GIT_CONFIG_COUNT contains a non-numeric string (parse error surfaces instead of this message).

Common situations: Deeply nested tool/shell wrappers (direnv, mise hooks, CI matrix scripts) each incrementing GIT_CONFIG_COUNT until it explodes; a leftover junk GIT_CONFIG_COUNT exported in shell rc files; a script that sets it to a non-number causing the sibling parse error.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


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

Appendix: source

Thrown at src/github_relay.rs:856

            child.args(&command[1..]);
            child
        };
        let executable = std::env::current_exe()?;
        let mut paths = vec![
            executable
                .parent()
                .ok_or_else(|| eyre::eyre!("missing mise executable directory"))?
                .to_path_buf(),
        ];
        paths.extend(std::env::split_paths(
            &std::env::var_os("PATH").unwrap_or_default(),
        ));
        child.env("PATH", std::env::join_paths(paths)?);
        let count: usize = std::env::var("GIT_CONFIG_COUNT")
            .unwrap_or_else(|_| "0".into())
            .parse()?;
        if count > 1000 {
            bail!("too many inherited Git configuration entries");
        }
        let base = format!("http://{address}/{capability}/git/");
        for (index, source) in [
            "https://github.com/",
            "git@github.com:",
            "ssh://git@github.com/",
        ]
        .iter()
        .enumerate()
        {
            child.env(
                format!("GIT_CONFIG_KEY_{}", count + index),
                format!("url.{base}.insteadOf"),
            );
            child.env(format!("GIT_CONFIG_VALUE_{}", count + index), source);
        }
        child
            .env("GIT_CONFIG_COUNT", (count + 3).to_string())

View on GitHub (pinned to 533346cc37)