jdx/mise · error

executable identity cache contains too many bytes

Error message

executable identity cache contains too many bytes

What it means

store_executable_identity enforces a total byte budget of MAX_EXECUTABLE_IDENTITY_BYTES (262,144 bytes) across all cached identity blobs: retained_bytes - previous_size + stdout.len() must stay within budget. Many small or a few large identities can both exhaust it.

Source

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

    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();
        let hello = lines
            .next_line()
            .await?
            .ok_or_else(|| eyre::eyre!("connection closed before the agent handshake"))?;

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Trim identity stdout to the minimal version line before storing
  2. Probe fewer distinct executables per session
  3. Restart the agent/session — the identity cache is in-memory and resets
Defensive patterns

Strategy: validation

Validate before calling

const MAX_IDENTITY_BYTES: usize = 256 * 1024;
let mut retained: usize = 0;
fn fits_budget(retained: usize, stdout_len: usize) -> bool {
    retained + stdout_len <= MAX_IDENTITY_BYTES
}

Prevention

When it happens

Trigger: Storing a new identity when existing blobs already occupy close to 256KiB; or one blob near the 64KiB per-entry limit pushing the total over budget.

Common situations: Sessions probing many toolchains with verbose identity output; long-lived agents accumulating identities without restart.

Related errors


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