{"record":{"id":"eae31c47c1a5393d","repo":"affaan-m/ECC","slug":"missing-merge-payload-for-uninstall-operation-d","errorCode":null,"errorMessage":"Missing merge payload for uninstall: ${operation.destinationPath}","messagePattern":"Missing merge payload for uninstall: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install-lifecycle.js","lineNumber":1007,"sourceCode":"        cleanupTargets: []\n      };\n    }\n\n    const existingDestination = getContainedExistingPath(\n      operation.destinationPath,\n      trustedRoot,\n      'uninstall'\n    );\n    if (!existingDestination) {\n      return {\n        removedPaths: [],\n        cleanupTargets: []\n      };\n    }\n\n    const payload = getOperationJsonPayload(operation);\n    if (payload === undefined) {\n      throw new Error(`Missing merge payload for uninstall: ${operation.destinationPath}`);\n    }\n\n    const currentValue = readJsonNoFollow(\n      getManagedDestination(existingDestination, trustedRoot, 'uninstall').managedPath\n    );\n    const nextValue = deepRemoveJsonSubset(currentValue, payload);\n    if (nextValue === JSON_REMOVE_SENTINEL) {\n      const removedPath = removeContainedPath(\n        operation.destinationPath,\n        trustedRoot,\n        'uninstall',\n        { force: true }\n      );\n      return {\n        removedPaths: removedPath ? [operation.destinationPath] : [],\n        cleanupTargets: removedPath ? [removedPath] : []\n      };\n    }","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install-lifecycle.js#L989-L1025","documentation":"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.","triggerScenarios":"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.","commonSituations":"Interrupted installs leaving partial state; hand-edited state files; uninstalling content installed by a different (older/newer) installer version.","solutions":["Re-run the install to regenerate complete operation metadata, then uninstall again.","Restore the destination file manually from backup if metadata cannot be repaired.","Report the missing-payload path — it usually signals an install-lifecycle bug writing incomplete operation records."],"exampleFix":"// before\nuninstallFromRecord(record); // missing payload\n// after\nif (record.operations.some(op => op.kind === 'merge-json' && op.payload === undefined)) {\n  await reinstallThenUninstall();\n} else {\n  uninstallFromRecord(record);\n}","handlingStrategy":"validation","validationCode":"const bad = record.state.operations.filter(op => op.kind === 'merge-json' && op.payload === undefined);\nif (bad.length) throw new Error('cannot uninstall: merge-json ops missing payload');","typeGuard":"function isUninstallable(op) { return op.kind !== 'merge-json' || op.payload !== undefined; }","tryCatchPattern":"try { uninstallFromRecord(record); } catch (e) { if (String(e.message).startsWith('Missing merge payload for uninstall')) { await reinstallThenUninstall(); } else throw e; }","preventionTips":["Only uninstall with the same installer version that installed","Verify state integrity before uninstall","Let installs complete before uninstalling"],"tags":["install","uninstall","json","missing-payload"],"backgroundTag":"missing-required-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}