{"record":{"id":"dba16511313e7104","repo":"affaan-m/ECC","slug":"missing-merge-payload-for-repair-operation-dest","errorCode":null,"errorMessage":"Missing merge payload for repair: ${operation.destinationPath}","messagePattern":"Missing merge payload for repair: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install-lifecycle.js","lineNumber":822,"sourceCode":"      copyContainedFile(sourcePath, operation.destinationPath, trustedRoot, 'repair');\n    }\n    return operation.destinationPath;\n  }\n\n  if (operation.kind === 'render-template') {\n    const renderedContent = getOperationTextContent(operation);\n    if (renderedContent === null) {\n      throw new Error(`Missing rendered content for repair: ${operation.destinationPath}`);\n    }\n\n    writeContainedFile(operation.destinationPath, renderedContent, trustedRoot, 'repair');\n    return operation.destinationPath;\n  }\n\n  if (operation.kind === 'merge-json') {\n    const payload = getOperationJsonPayload(operation);\n    if (payload === undefined) {\n      throw new Error(`Missing merge payload for repair: ${operation.destinationPath}`);\n    }\n\n    const existingDestination = getContainedExistingPath(operation.destinationPath, trustedRoot, 'repair');\n    const currentValue = existingDestination\n      ? readJsonNoFollow(\n        getManagedDestination(existingDestination, trustedRoot, 'repair').managedPath\n      )\n      : {};\n    const mergedValue = deepMergeJson(currentValue, payload);\n\n    writeContainedFile(operation.destinationPath, formatJson(mergedValue), trustedRoot, 'repair');\n    return operation.destinationPath;\n  }\n\n  if (operation.kind === 'update-claude-settings') {\n    assertClaudeSettingsDestination(operation, trustedRoot, target);\n    const managedHooks = validateManagedHooks(operation.managedHooks);\n    const previousManagedHooks = operation.previousManagedHooks","sourceCodeStart":804,"sourceCodeEnd":840,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install-lifecycle.js#L804-L840","documentation":"Thrown during repair when a 'merge-json' operation has no JSON payload (getOperationJsonPayload returns undefined). Repair needs the payload to re-merge into the existing destination file; a payload-less merge operation cannot be replayed.","triggerScenarios":"Repairing an install whose recorded merge-json operation has an undefined/missing payload — incomplete state record, schema drift between writer and reader, or a programmatically constructed operation missing `payload`.","commonSituations":"Partial install-state files from interrupted installs; version mismatch where older states omit payload; manually merged/edited state JSON.","solutions":["Re-run install to regenerate a complete install-state record","Verify each merge-json operation in the state has a defined payload before repairing","Align versions of the installer that wrote the state and the code performing repair","Discard the corrupt state record and reinstall cleanly"],"exampleFix":"// before\nrepairFromRecord(record); // record.operations[i].payload === undefined\n// after\nconst ok = record.operations.every(op => op.kind !== 'merge-json' || op.payload !== undefined);\nif (!ok) await reinstall(); else repairFromRecord(record);","handlingStrategy":"validation","validationCode":"const bad = record.state.operations.find(op => op.kind === 'merge-json' && op.payload === undefined);\nif (bad) throw new Error(`merge-json op for ${bad.destinationPath} lacks payload; reinstall`);","typeGuard":"function hasMergePayload(op) { return op.kind !== 'merge-json' || op.payload !== undefined; }","tryCatchPattern":"try { repairFromRecord(record); } catch (e) { if (String(e.message).startsWith('Missing merge payload for repair')) { await reinstallAndRepair(); } else throw e; }","preventionTips":["Validate state records before replaying operations","Avoid interrupted installs; retry failed installs to completion","Pin installer version so state schema matches"],"tags":["install","repair","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"}