jdx/mise · error · eyre::Report

executable identity contains an unsupported environment vari

Error message

executable identity contains an unsupported environment variable

What it means

executable_identity_key accepts exactly two environment variable names — RUSTUP_HOME and RUSTUP_TOOLCHAIN — because those define a rustc executable's identity. Any other key in the environment map is rejected so identities stay well-defined.

Source

Thrown at crates/mise-cache-core/src/agent.rs:1676

        {
            bail!("task action manifest contains too many predictions");
        }
        state
            .predictions
            .insert(prediction.invocation.clone(), prediction);
        Ok(AgentResponse::ActionPredictionRecorded)
    }

    fn executable_identity_key(
        &self,
        executable: PathBuf,
        environment: BTreeMap<String, Option<String>>,
    ) -> Result<ExecutableIdentityKey> {
        if !environment
            .keys()
            .all(|name| matches!(name.as_str(), "RUSTUP_HOME" | "RUSTUP_TOOLCHAIN"))
        {
            bail!("executable identity contains an unsupported environment variable");
        }
        Ok(ExecutableIdentityKey {
            executable,
            environment,
        })
    }

    fn find_executable_identity(
        &self,
        executable: PathBuf,
        environment: BTreeMap<String, Option<String>>,
    ) -> Result<AgentResponse> {
        let key = self.executable_identity_key(executable, environment)?;
        let stdout = self
            .executable_identities
            .lock()
            .unwrap()
            .get(&key)

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Filter the map to {RUSTUP_HOME, RUSTUP_TOOLCHAIN} before calling
  2. If a new variable is genuinely needed, upgrade agent and client together after support is added

Example fix

// before
let env = full_process_env(); // includes RUSTFLAGS, PATH, ...
agent.store_executable_identity(rustc, env, stdout).await?;
// after
let env: BTreeMap<_,_> = full_process_env()
    .into_iter()
    .filter(|(k, _)| matches!(k.as_str(), "RUSTUP_HOME" | "RUSTUP_TOOLCHAIN"))
    .collect();
agent.store_executable_identity(rustc, env, stdout).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn rustc_identity_env(env: &BTreeMap<String, Option<String>>) -> BTreeMap<String, Option<String>> {
    env.iter()
        .filter(|(k, _)| matches!(k.as_str(), "RUSTUP_HOME" | "RUSTUP_TOOLCHAIN"))
        .map(|(k, v)| (k.clone(), v.clone()))
        .collect()
}

Type guard

fn is_supported_identity_env(env: &BTreeMap<String, Option<String>>) -> bool {
    env.keys().all(|k| matches!(k.as_str(), "RUSTUP_HOME" | "RUSTUP_TOOLCHAIN"))
}

Prevention

When it happens

Trigger: Calling find_executable_identity / store_executable_identity with a map containing anything else: RUSTFLAGS, CARGO_HOME, PATH, LD_LIBRARY_PATH, or an empty-string key.

Common situations: Forwarding a whole environment block instead of an allowlist; a newer client wanting extra variables before the deployed agent supports them.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/0f448c046d9481e9. Report an issue: GitHub.