Hmbown/CodeWhale · error
imported content digest mismatch after copy; aborted
Error message
imported content digest mismatch after copy; aborted
What it means
After copying, `import_external` recomputes the package digest of the destination and compares it to the pre-copy source digest. A mismatch means the copied content on disk does not match what was audited before the copy, so the import aborts rather than installing unverified content.
Solutions
- Re-run the import; transient concurrent modification is the most common cause.
- Quiesce concurrent writers (close editors, stop sync tools) so the external source is stable during import.
- Remove the partially copied destination directory and import again from a clean state.
- Verify the source package contains no files the copier skips (symlinks, marker files) that shift the digest.
Defensive patterns
Strategy: retry
Validate before calling
let before = verify_expected_digest(&source_path, Some(&expected_digest))?; // re-verify source stability immediately before import
Try / catch
if err.to_string().contains("digest mismatch after copy") {
// remove partial dest and retry once with no concurrent writers
} Prevention
- Do not edit external skill sources while an import is running.
- Pause file-sync/editor tools during skill imports.
- Clean up partially copied destinations before retrying.
When it happens
Trigger: `package_digest::compute_package_digest(&dest)` differs from `expected_digest` after `copy_skill_package` completes — e.g. the source changed mid-copy, a marker file was skipped, or a partial copy left the destination incomplete.
Common situations: Another process (editor sync, git checkout, another agent) modified the external source between the pre-copy and post-copy digest checks; a partial/failed copy; platform quirks turning symlinks into real files and shifting the tree.
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
- Checksum manifest is missing
- Checksum mismatch for
- skill content changed since audit
- skill ' ' has unknown package digest; refusing mutation
- The update checksum did not match. Your current app is…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/52a3c39d96f49c9b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/skills/mutation.rs:777
return Err(err).context("failed to replace destination with imported skill");
}
backup_path = Some(backup);
} else if let Err(err) = fs::rename(&staging, &dest) {
let _ = fs::remove_dir_all(&staging);
return Err(err).context("failed to install imported skill");
}
validate_owned_target_chain(anchor, &skills_dir, true)?;
validate_owned_child(&skills_dir, &dest, true)?;
// Keep backup until digest + marker finalize succeed so a failed import
// can restore the previous owned skill.
let finalize = (|| -> Result<String> {
let _ = verify_expected_digest(&source_path, Some(&expected_digest))?;
validate_owned_target_chain(anchor, &skills_dir, true)?;
validate_owned_child(&skills_dir, &dest, true)?;
let after = package_digest::compute_package_digest(&dest)?;
if after != expected_digest {
bail!("imported content digest mismatch after copy; aborted");
}
write_installed_from_v2(
&dest,
&format!("import:{}", source_skill.safe_display_path),
None,
&expected_digest,
&after,
&source_id.canonical_name,
)?;
Ok(after)
})();
let after = match finalize {
Ok(after) => {
if let Some(backup) = backup_path.take() {
fs::remove_dir_all(&backup).ok();
}
afterView on GitHub (pinned to 73e0f67d83)