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
- Restart the mise task/session so shim and agent share one binary and protocol
- Unset inherited MISE_CACHE_* variables in profiles and CI images
- 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
- Never carry MISE_CACHE_* across sessions, machines, or mise upgrades
- Restart sessions after upgrading mise
- Consider publish failures advisory: log and retry on the next build
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
- cache agent returned an incomplete blob lookup response
- cache agent returned an unexpected blob lookup response
- cache agent did not return the rustc identity
- cache agent did not store the rustc identity
- rustc produced no cacheable outputs
AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22).
Data as JSON: /api/errors/a33d31340f27a04d.
Report an issue: GitHub.