jdx/mise · error · eyre::Report

cache agent returned an unexpected publish response

Error message

cache agent returned an unexpected publish response

What it means

A reply to StoreBlob/StoreActionResult that is neither Stored, ActionStored, nor Error — e.g. Blobs or Hello (src/cache/rustc.rs:814-819). Responses are matched positionally across the batched request list on one JSON-lines stream, so a variant mismatch means the stream is skewed: a version-skewed agent, a stale socket, or a desynchronized connection. Publishing aborts with a warning; compilation results are unaffected.

Source

Thrown at src/cache/rustc.rs:818

    let mut published = BTreeSet::new();
    for (digest, source) in blobs {
        if published.insert(digest.clone()) {
            requests.push(AgentRequest::StoreBlob { digest, source });
        }
    }
    requests.push(AgentRequest::StoreActionResult {
        result: RemoteActionResult {
            action: action.clone(),
            metadata: Some(metadata.0),
            output_root: Some(directory.0),
            version: 1,
        },
    });
    for response in session::request_agent(&requests)? {
        match response {
            AgentResponse::Stored { .. } | AgentResponse::ActionStored { .. } => {}
            AgentResponse::Error { message } => bail!(message),
            _ => bail!("cache agent returned an unexpected publish response"),
        }
    }
    Ok(())
}

fn staged_bytes(directory: &Path, name: &str, bytes: &[u8]) -> Result<(CacheDigest, PathBuf)> {
    let path = directory.join(name);
    std::fs::write(&path, bytes)?;
    Ok((CacheDigest::blake3(bytes), path))
}

#[cfg(unix)]
fn file_mode(metadata: &std::fs::Metadata) -> u32 {
    use std::os::unix::fs::PermissionsExt as _;
    metadata.permissions().mode() & 0o644
}

#[cfg(windows)]

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Restart the mise task/session so shim and agent share one binary and protocol
  2. Unset inherited MISE_CACHE_* variables in profiles and CI images
  3. Confirm one mise version is active for both the task runner and the shim
Defensive patterns

Strategy: validation

Validate before calling

# ensure the publishing shim and the agent share one mise build:
mise --version
test -S "$MISE_CACHE_SOCKET" || echo 'stale or missing cache agent — restart the mise session'

Type guard

fn is_unexpected_publish(r: &AgentResponse) -> bool {
    !matches!(r, AgentResponse::Stored { .. } | AgentResponse::ActionStored { .. } | AgentResponse::Error { .. })
}

Prevention

When it happens

Trigger: Publishing through MISE_CACHE_SOCKET inherited from a session spawned by a different mise build whose AgentResponse enum differs; a response stream desynchronized after a garbled line; a foreign process answering on the socket.

Common situations: Same wiring-skew contexts as the other 'unexpected ... response' errors: exported cache env vars, mixed mise versions, reused session directories.

Related errors


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