jdx/mise · error

network Git calls do not accept a work tree, alternate…

Error message

network Git calls do not accept a work tree, alternate index, or stdin

What it means

mise's git plumbing wrapper distinguishes local plumbing calls from network commands (fetch/push/ls-remote). Network calls run with the user's normal git config but must not carry a work tree, alternate index file, or stdin, since those only make sense for repository-local operations. Passing any of them to network_output is a programming error and is rejected up front.

Solutions

  1. Construct the PlumbingCall for network commands without work_tree/index_file/stdin
  2. Use the local plumbing entry point instead if the call genuinely needs a work tree or index
  3. Ensure the call is one of the supported network subcommands (fetch, push, ls-remote)
  4. Review the call site that builds the PlumbingCall and strip local-only fields

Example fix

// before
repo.network_output(PlumbingCall { subcommand: "fetch", work_tree: Some(repo.path), .. })
// after
repo.network_output(PlumbingCall { subcommand: "fetch", work_tree: None, index_file: None, stdin: None, .. })
Defensive patterns

Strategy: type-guard

Validate before calling

fn assert_network_call(call: &PlumbingCall) {
    assert!(call.work_tree.is_none() && call.index_file.is_none() && call.stdin.is_none(),
        "network calls must not carry local-only fields");
}

Type guard

fn is_network_call(call: &PlumbingCall) -> bool {
    matches!(call.subcommand, "fetch" | "push" | "ls-remote")
        && call.work_tree.is_none()
        && call.index_file.is_none()
        && call.stdin.is_none()
}

Prevention

When it happens

Trigger: Calling Git::network_output with a PlumbingCall that has work_tree, index_file, or stdin set — i.e., misuse of the internal API when wiring fetch/push/ls-remote.

Common situations: Refactoring plumbing call construction and reusing a local-call builder for network operations; copying a call struct that still carries an index file or stdin payload from a prior local command.

Related errors


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

Appendix: source

Thrown at src/git.rs:875

            .stderr(std::process::Stdio::inherit())
            .stdin(std::process::Stdio::null());
        cmd.status()
            .wrap_err_with(|| format!("failed to run {}", describe_plumbing(&cmd)))
    }

    /// Runs the call and returns its trimmed stdout.
    pub(crate) fn output_str(&self, call: PlumbingCall<'_>) -> Result<String> {
        let out = self.output(call)?;
        Ok(String::from_utf8_lossy(&out).trim().to_string())
    }

    /// Runs a network command (`fetch`, `push`, `ls-remote`) against this
    /// repository with the user's normal git configuration: credential
    /// helpers, ssh settings, and URL rewrites apply, while hooks, filters,
    /// and aliases still cannot act on mise's repository because only
    /// plumbing runs here. Prompts are disabled when nobody is attending.
    pub(crate) fn network_output(&self, call: PlumbingCall<'_>) -> Result<std::process::Output> {
        eyre::ensure!(
            call.work_tree.is_none() && call.index_file.is_none() && call.stdin.is_none(),
            "network Git calls do not accept a work tree, alternate index, or stdin"
        );
        let git =
            plumbing_binary().ok_or_else(|| eyre!("no unattended git executable is available"))?;
        let mut cmd = std::process::Command::new(git);
        sanitize_git_command(&mut cmd);
        if !console::user_attended_stderr() {
            cmd.env("GIT_TERMINAL_PROMPT", "0");
        }
        cmd.args([
            "-c",
            &github_credential_config("github.com"),
            "-c",
            &github_credential_config("github.com:443"),
        ]);
        cmd.env("GIT_OPTIONAL_LOCKS", "0")
            .env("LC_ALL", "C")

View on GitHub (pinned to 533346cc37)