affaan-m/ECC · error

Missing merge payload for uninstall

Error message

Missing merge payload for uninstall: ${operation.destinationPath}

What it means

During uninstall of merge-type operations, the recorded JSON payload for the destination file is missing, so the tool cannot restore/merge the prior content. This indicates corrupted or truncated install metadata (the operation was recorded without its payload) rather than a user-input mistake; the faulting input is the uninstall operation's JSON payload.

Solutions

  1. Re-run the install to regenerate complete operation metadata, then uninstall again.
  2. Restore the destination file manually from backup if metadata cannot be repaired.
  3. Report the missing-payload path — it usually signals an install-lifecycle bug writing incomplete operation records.

Example fix

// before
uninstallFromRecord(record); // missing payload
// after
if (record.operations.some(op => op.kind === 'merge-json' && op.payload === undefined)) {
  await reinstallThenUninstall();
} else {
  uninstallFromRecord(record);
}
Defensive patterns

Strategy: validation

Validate before calling

const bad = record.state.operations.filter(op => op.kind === 'merge-json' && op.payload === undefined);
if (bad.length) throw new Error('cannot uninstall: merge-json ops missing payload');

Type guard

function isUninstallable(op) { return op.kind !== 'merge-json' || op.payload !== undefined; }

Try / catch

try { uninstallFromRecord(record); } catch (e) { if (String(e.message).startsWith('Missing merge payload for uninstall')) { await reinstallThenUninstall(); } else throw e; }

Prevention

When it happens

Trigger: Uninstalling with a recorded merge-json operation whose payload is undefined — incomplete install-state, schema drift, or the destination-merge shortcut path returned a cleanup object but the operation itself has no payload.

Common situations: Interrupted installs leaving partial state; hand-edited state files; uninstalling content installed by a different (older/newer) installer version.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/eae31c47c1a5393d. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/install-lifecycle.js:1007

        cleanupTargets: []
      };
    }

    const existingDestination = getContainedExistingPath(
      operation.destinationPath,
      trustedRoot,
      'uninstall'
    );
    if (!existingDestination) {
      return {
        removedPaths: [],
        cleanupTargets: []
      };
    }

    const payload = getOperationJsonPayload(operation);
    if (payload === undefined) {
      throw new Error(`Missing merge payload for uninstall: ${operation.destinationPath}`);
    }

    const currentValue = readJsonNoFollow(
      getManagedDestination(existingDestination, trustedRoot, 'uninstall').managedPath
    );
    const nextValue = deepRemoveJsonSubset(currentValue, payload);
    if (nextValue === JSON_REMOVE_SENTINEL) {
      const removedPath = removeContainedPath(
        operation.destinationPath,
        trustedRoot,
        'uninstall',
        { force: true }
      );
      return {
        removedPaths: removedPath ? [operation.destinationPath] : [],
        cleanupTargets: removedPath ? [removedPath] : []
      };
    }

View on GitHub (pinned to 8321021c54)