jdx/mise · error

task cache artifact checksum mismatch

Error message

task cache artifact checksum mismatch

What it means

Before a cache entry is trusted, mise recomputes the artifact checksum (calculate_artifact_checksum over the manifest and archive) and compares it to the expected checksum recorded in the manifest/entry. Any difference aborts the hit, because the archive may be corrupted or tampered with.

Solutions

  1. Delete the affected cache entry and rerun the task to regenerate and re-upload a fresh artifact.
  2. Purge the local (or remote) task-artifacts cache if many entries fail.
  3. Check for network/storage layers that corrupt or truncate uploads (proxies, size limits).
  4. Verify clock/cleanup jobs aren't truncating archives mid-write; ensure atomic uploads.

Example fix

// before
remote artifact downloaded at 90% -> sha256 mismatch
// after
rm -rf ~/.cache/mise/task-artifacts && mise run build  # re-download or regenerate intact artifact
Defensive patterns

Strategy: retry

Validate before calling

const actual = sha256(await fs.readFile(archivePath));
if (actual !== manifest.artifact.sha256) console.warn('cache entry corrupt; regenerating');

Try / catch

// retry once after clearing the corrupt entry
try { restore(entry) } catch (e) {
  if (String(e).includes('checksum mismatch')) { cache.delete(entry); regenerateAndReupload(); }
  else throw e;
}

Prevention

When it happens

Trigger: verify_artifact_checksum during cache restore: expected checksum exists (or an archive path is required) and calculate_artifact_checksum returns a hash different from the stored one — truncated download/upload, bitrot, or a modified archive file.

Common situations: Flaky network during remote cache download; disk corruption on long-lived CI caches; someone re-uploading artifacts without updating the manifest; storage tiers that silently truncate large files.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/7ea53eb97bb11689. Report an issue: GitHub.

Appendix: source

Thrown at src/task/task_cache.rs:940

        execution_duration_ns: manifest.execution_duration_ns,
        archive_checksum,
    };
    let encoded = serde_json::to_string(&material)?;
    Ok(format!("blake3:{}", hash::hash_blake3_to_str(&encoded)))
}

fn verify_artifact_checksum(manifest: &CacheManifest, archive_path: Option<&Path>) -> Result<()> {
    let Some(expected) = &manifest.artifact_checksum else {
        return Ok(());
    };
    let archive_path = if manifest.roots.is_empty() {
        None
    } else {
        Some(archive_path.ok_or_else(|| eyre!("task cache archive is missing"))?)
    };
    let actual = calculate_artifact_checksum(manifest, archive_path)?;
    if actual != *expected {
        bail!("task cache artifact checksum mismatch");
    }
    Ok(())
}

pub(crate) fn task_cache_entries(task: &Task, root: &Path) -> Result<Vec<TaskCacheEntry>> {
    Settings::get().ensure_experimental("task artifact caching")?;
    let cache_dir = task_cache_dir();
    if !cache_dir.is_dir() {
        return Ok(Vec::new());
    }
    let identity = task_cache_identity(task, root);
    let current_key = file::read_to_string(task_cache_state_path(task, root))
        .ok()
        .map(|key| key.trim().to_string());
    let mut entries = Vec::new();
    for entry in fs::read_dir(&cache_dir)? {
        let entry = entry?;
        let manifest_path = entry.path();

View on GitHub (pinned to 533346cc37)