affaan-m/ECC · error

Unsupported repair operation kind

Error message

Unsupported repair operation kind: ${operation.kind}

What it means

Thrown by the repair operation executor when operation.kind is not one of the supported kinds (e.g. copy-file, render-template, merge-json, remove). Indicates the repair dispatcher encountered an operation kind it does not know how to execute.

Solutions

  1. Update the installer to the same version that wrote the install-state
  2. Inspect operation.kind in the state record and correct/remove unknown entries
  3. Delete stale state and reinstall so all operations use supported kinds

Example fix

// before: reading new-kind state with old installer
repairFromRecord(record); // kind: 'symlink' unknown to old code
// after: upgrade installer first
await updateInstallerToLatest();
repairFromRecord(record);
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ['copy-file','render-template','merge-json','remove'];
const unsupported = record.state.operations.filter(op => !SUPPORTED.includes(op.kind));
if (unsupported.length) throw new Error(`unknown kinds: ${unsupported.map(o => o.kind).join(',')}`);

Type guard

const isSupportedKind = (kind) => ['copy-file','render-template','merge-json','remove'].includes(kind);

Try / catch

try { repairFromRecord(record); } catch (e) { if (String(e.message).startsWith('Unsupported repair operation kind')) { await upgradeInstallerThenRepair(record); } else throw e; }

Prevention

When it happens

Trigger: An install-state record contains an operation kind added by a newer installer version, or a corrupted/forged operation object with an unrecognized or empty `kind`.

Common situations: Rolling back to an older installer that doesn't know new operation kinds; editing state JSON by hand; mixing plugin versions where state written by v2 is read by v1.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

        beforeCommit() {
          getManagedDestination(settingsPath, trustedRoot, 'repair');
        },
      }
    );
    return operation.destinationPath;
  }

  if (operation.kind === 'remove') {
    const removedPath = removeContainedPath(
      operation.destinationPath,
      trustedRoot,
      'repair',
      { recursive: true, force: true }
    );
    return removedPath ? operation.destinationPath : null;
  }

  throw new Error(`Unsupported repair operation kind: ${operation.kind}`);
}

function executeUninstallOperation(operation, trustedRoot, options = {}) {
  // Confine deletes to the trusted install root (GHSA-hfpv-w6mp-5g95).
  if (operation.kind === 'copy-file') {
    if (options.preserveDriftedCopies) {
      const existingDestination = getContainedExistingPath(
        operation.destinationPath,
        trustedRoot,
        'uninstall',
        { allowFinalSymlink: true }
      );
      if (!existingDestination) {
        return {
          removedPaths: [],
          cleanupTargets: []
        };
      }

View on GitHub (pinned to 8321021c54)