jdx/mise · error

executable identity cache contains too many entries

Error message

executable identity cache contains too many entries

What it means

store_executable_identity caps the in-memory identity cache at MAX_EXECUTABLE_IDENTITIES (64) entries. The cap is checked only when inserting a NEW key; overwriting an existing key never trips it.

Source

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

            .cloned();
        Ok(AgentResponse::ExecutableIdentity { stdout })
    }

    fn store_executable_identity(
        &self,
        executable: PathBuf,
        environment: BTreeMap<String, Option<String>>,
        stdout: Vec<u8>,
    ) -> Result<AgentResponse> {
        if stdout.len() > MAX_EXECUTABLE_IDENTITY_SIZE {
            bail!("executable identity exceeds {MAX_EXECUTABLE_IDENTITY_SIZE} bytes");
        }
        let key = self.executable_identity_key(executable, environment)?;
        let mut identities = self.executable_identities.lock().unwrap();
        let is_new = !identities.contains_key(&key);
        let previous_size = identities.get(&key).map_or(0, Vec::len);
        if is_new && identities.len() >= MAX_EXECUTABLE_IDENTITIES {
            bail!("executable identity cache contains too many entries");
        }
        let retained_bytes = identities.values().map(Vec::len).sum::<usize>();
        if retained_bytes - previous_size + stdout.len() > MAX_EXECUTABLE_IDENTITY_BYTES {
            bail!("executable identity cache contains too many bytes");
        }
        identities.insert(key, stdout.clone());
        Ok(AgentResponse::ExecutableIdentity {
            stdout: Some(stdout),
        })
    }

    /// Serve newline-delimited protocol requests on an authenticated session stream.
    pub async fn handle_connection<S>(&self, stream: S) -> Result<()>
    where
        S: AsyncRead + AsyncWrite + Unpin,
    {
        let (reader, mut writer) = tokio::io::split(stream);
        let mut lines = BufReader::new(reader).lines();

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Limit probing to the few executables actually used for compilation
  2. Reuse one resolved toolchain per session instead of probing many paths
  3. Restart the session to reset the in-memory cache if it filled with one-off probes
Defensive patterns

Strategy: validation

Validate before calling

const MAX_IDENTITIES: usize = 64;
let mut probed: HashSet<ExecutableIdentityKey> = HashSet::new();
fn should_probe(probed: &HashSet<ExecutableIdentityKey>, key: &ExecutableIdentityKey) -> bool {
    probed.contains(key) || probed.len() < MAX_IDENTITIES
}

Prevention

When it happens

Trigger: A session probing 65+ distinct (executable, RUSTUP_*) identity combinations — e.g. many toolchain paths or rustup shims resolved to different binaries.

Common situations: Enumerating every binary in a toolchain dir; multi-toolchain workspaces probing rustc from many install roots in one session.

Related errors


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