jdx/mise · error

remote mise candidate discovery returned a truncated respons

Error message

remote mise candidate discovery returned a truncated response

What it means

mise discovers remote mise executables by running a POSIX script under sh -lc that prints each absolute executable path terminated with a NUL byte; parse_remote_mise_candidates() treats a non-empty response that does not end in NUL as truncated. Any output appended after the candidate list — a chatty login profile, a motd banner, or a shell whose printf cannot emit \0 — breaks the NUL-termination invariant and aborts.

Source

Thrown at src/system/remote.rs:637

  case "$1" in
    /*) if [ -x "$1" ]; then printf '%s\000' "$1"; fi ;;
  esac
}
old_ifs=$IFS
IFS=:
for directory in $PATH; do
  if [ -z "$directory" ]; then directory=.; fi
  emit_mise_candidate "$directory/mise"
done
IFS=$old_ifs
for candidate in "$HOME/.local/bin/mise" "$HOME/.local/share/mise/bin/mise" "$HOME/.cargo/bin/mise" /usr/local/bin/mise /opt/homebrew/bin/mise; do
  emit_mise_candidate "$candidate"
done"#
}

fn parse_remote_mise_candidates(output: &str) -> Result<Vec<String>> {
    if !output.is_empty() && !output.ends_with('\0') {
        bail!("remote mise candidate discovery returned a truncated response");
    }
    output
        .split_terminator('\0')
        .map(validated_remote_command)
        .collect::<Result<IndexSet<_>>>()
        .map(IndexSet::into_iter)
        .map(Iterator::collect)
}

#[derive(Clone, Debug, Eq, PartialEq)]
struct RemoteMiseIdentity {
    version: String,
    fingerprint: String,
}

fn remote_mise_candidate_identities(
    session: &SshSession<'_>,
    candidates: &[String],

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Silence stdout noise from the remote login environment: guard echo/banner lines in ~/.profile, ~/.bashrc, /etc/profile with [ -z "$PS1" ] && return or send them to stderr
  2. Verify the round trip manually: ssh <host> sh -lc 'printf x\\000' | od -c should show a 0000-escaped byte
  3. Bypass discovery entirely by setting remote_mise (known remote path) or mise_bin (upload a local binary) for that host

Example fix

# before (~/.profile on the remote host)
echo "Welcome to build-server!"
export NVM_DIR="$HOME/.nvm"

# after — non-interactive shells stay silent on stdout
if [ -n "$PS1" ]; then echo "Welcome to build-server!"; fi
export NVM_DIR="$HOME/.nvm"
Defensive patterns

Strategy: fallback

Validate before calling

# preflight: the remote login shell must round-trip NUL-terminated stdout
ssh <host> sh -lc 'printf x\\000' | od -An -c | grep -q '\\0' && echo ok || echo 'login shell pollutes stdout or drops NUL'

Try / catch

if e.to_string().contains("truncated response") {
    // quiet remote login-shell stdout noise, or set remote_mise/mise_bin to skip discovery
}

Prevention

When it happens

Trigger: discover_remote_mise_candidates() or the post-bootstrap_command candidate scan running `sh -lc <script>` where the remote login shell sources .profile/.bashrc/.zprofile that echoes text to stdout; a remote /bin/sh with a non-POSIX printf that mangles or drops the '\000' escape; ssh output truncation cutting the final NUL.

Common situations: Cloud images and hardened servers that print banners or last-login messages for login shells; nvm/conda/module init snippets echoing status; admins who add echo lines to /etc/profile; exotic or ancient remote shells.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/ae994403e396cef8. Report an issue: GitHub.