Hmbown/CodeWhale · error
skill content changed since audit
Error message
skill content changed since audit (expected {expected}, found {current}); re-review before mutating What it means
Mutations accept an optional expected digest captured at audit/review time. verify_expected_digest recomputes the package digest and, if an expected digest was supplied and differs from the current content, refuses to mutate: the package changed after the user reviewed it, so the approval no longer applies. This is a TOCTOU/integrity guard against mutating content the user never saw.
Solutions
- Re-review the skill content at the path, compute the new digest, and pass the fresh digest as the expected value
- Re-run the audit/review workflow (/skills review) and retry the mutation with the newly recorded digest
- If the change was unintended, restore the package content to the audited state (e.g. from version control) and retry
- If the package is corrupted, remove it and re-import/re-install from the source
Example fix
// before
trust_skill(resolved.id, Some("sha256:old"), &ctx)?; // content already changed
// after
let current = package_digest::compute_package_digest(&path)?; // re-review first
trust_skill(resolved.id, Some(current), &ctx)?; Defensive patterns
Strategy: validation
Validate before calling
fn content_matches_audit(path: &Path, expected: Option<&str>) -> Result<bool> {
let Some(expected) = expected else { return Ok(true) };
let current = package_digest::compute_package_digest(path)?;
Ok(expected == current)
} Try / catch
match mutation::remove_skill(&audited, &path, &ctx) {
Err(e) if e.to_string().contains("skill content changed since audit") => {
eprintln!("package changed after review; re-review and recompute the digest");
}
other => other?,
} Prevention
- Recompute the package digest immediately before each mutation and pass it as expected
- Avoid editing skill files between review and mutation; pause watchers/sync tools during the window
- Treat any digest mismatch as a review-required event, never auto-retry with the old digest
When it happens
Trigger: Calling import_external, update_skill, remove_skill, or trust_skill with an expected digest argument while the package on disk has been modified since the audit — files added/edited inside the package, an incomplete download, or a different package at the same path.
Common situations: A background process or editor rewrote skill files between review and mutation; the user reviewed one version and the updater fetched another; a partially completed update left the tree mixed; disk corruption or a merge/tool rewrote SKILL.md.
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
- installed package failed content digest validation
- skill ' ' has unknown package digest; refusing mutation
- audited skill path does not match owned package
- audited skill root identity changed; refusing mutation
- Checksum mismatch for
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/95be4c86e86d16b4.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/skills/mutation.rs:561
_ => None,
}
.filter(|name| !name.is_empty())
.ok_or_else(|| {
anyhow::anyhow!(
"invalid on-disk package directory for skill '{}'",
skill_id.canonical_name
)
})?;
Ok(name)
}
fn verify_expected_digest(path: &Path, expected: Option<&str>) -> Result<Option<String>> {
let current = package_digest::compute_package_digest(path)
.with_context(|| format!("cannot digest {}", path.display()))?;
if let Some(expected) = expected
&& expected != current
{
bail!(
"skill content changed since audit (expected {expected}, found {current}); \
re-review before mutating"
);
}
Ok(Some(current))
}
fn ensure_remote_updatable(skill_dir: &Path) -> Result<()> {
let marker_path = skill_dir.join(install::INSTALLED_FROM_MARKER);
let body = fs::read_to_string(&marker_path)
.with_context(|| format!("failed to read {}", marker_path.display()))?;
let value: serde_json::Value = serde_json::from_str(&body)
.with_context(|| format!("malformed {}", install::INSTALLED_FROM_MARKER))?;
let spec = value
.get("spec")
.and_then(|v| v.as_str())
.unwrap_or_default();
if !install::is_registry_updatable_spec(spec) {View on GitHub (pinned to 73e0f67d83)