affaan-m/ECC · critical · Error

Refusing to overwrite an unowned or changed install-state at

Error message

Refusing to overwrite an unowned or changed install-state at ${plan.installStatePath}. Re-run the guided preview and review the existing state before retrying.

What it means

assertInstallStateUnchanged fingerprints the install-state file and compares existence plus sha256 to the fingerprint recorded at preview time. A mismatch means the state file appeared, disappeared, or was modified between preview and apply, so the installer refuses to overwrite content it may not own. The user is told to re-run the guided preview and review the state.

Solutions

  1. Re-run the guided preview to generate a fresh plan and fingerprint, review the shown state, then apply
  2. If you did not expect the change, inspect the install-state file to see who/what modified it before retrying
  3. Delete the foreign install-state only if you are certain nothing else owns it, then re-run preview and apply

Example fix

// before: apply with stale preview fingerprint
applySetup(stalePlan, staleFingerprint) // throws
// after
const plan = previewSetup(request)
const fp = fingerprintOf(plan) // fresh from preview
applySetup(plan, fp) // matches current state
Defensive patterns

Strategy: try-catch

Validate before calling

const current = fingerprintFile(plan.installStatePath)
if (current.exists !== expected.exists || current.sha256 !== expected.sha256) {
  // state changed since preview — re-run preview before applying
}

Try / catch

try {
  applySetup(plan, expectedFingerprint)
} catch (err) {
  if (err.message.includes('unowned or changed install-state')) {
    const freshPlan = previewSetup(plan.request) // regenerate and review
    applySetup(freshPlan.plan, freshPlan.fingerprint)
  } else throw err
}

Prevention

When it happens

Trigger: Calling the apply/confirm step with a stale expectedFingerprint while the install-state file at plan.installStatePath has been created, deleted, or edited since the preview was generated.

Common situations: Manually editing or deleting the install-state file between preview and apply; another install run modifying it; restoring the file from a backup with different bytes.

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 affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/a407012f3abd721f. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/multi-harness-setup.js:140

}

function operationIdentityMatches(stateOperation, plannedOperation) {
  return [
    'kind',
    'moduleId',
    'sourceRelativePath',
    'strategy',
    'scaffoldOnly',
  ].every(field => stateOperation[field] === plannedOperation[field]);
}

function assertInstallStateUnchanged(plan, expectedFingerprint) {
  const currentFingerprint = fingerprintFile(plan.installStatePath);
  if (
    currentFingerprint.exists !== expectedFingerprint.exists
    || currentFingerprint.sha256 !== expectedFingerprint.sha256
  ) {
    throw new Error(
      `Refusing to overwrite an unowned or changed install-state at ${plan.installStatePath}. `
      + 'Re-run the guided preview and review the existing state before retrying.'
    );
  }
}

function assertPriorInstallStateMatchesPlan(state, plan) {
  const target = state.target || {};
  const adapter = plan.adapter || {};
  if (
    target.id !== adapter.id
    || target.target !== adapter.target
    || target.kind !== adapter.kind
  ) {
    throw new Error(
      `Refusing to trust managed install-state at ${plan.installStatePath}: `
      + 'target identity does not match the current Kimi install plan.'
    );

View on GitHub (pinned to 8321021c54)