{"record":{"id":"6e35a4b9fca6eea4","repo":"ruvnet/ruflo","slug":"failure-rollback-failed-rollbackerror-instan","errorCode":null,"errorMessage":"${failure} Rollback failed: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}","messagePattern":"(.+?) Rollback failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"v3/@claude-flow/cli/src/proxy/activation.ts","lineNumber":180,"sourceCode":"    fs.rmSync(binaryBackup, { force: true });\n    fs.rmSync(manifestBackup, { force: true });\n    if (fs.existsSync(binary)) fs.copyFileSync(binary, binaryBackup);\n    if (fs.existsSync(manifest)) fs.copyFileSync(manifest, manifestBackup);\n    const installed = await installProxy({ version, log });\n    const effective = await launchAndVerify(installed.binaryPath, installed.version, wait);\n    return { ...installed, pid: effective.pid };\n  } catch (error) {\n    const failure = error instanceof Error ? error.message : String(error);\n    if (fs.existsSync(binaryBackup)) {\n      try {\n        await stopEffective(wait);\n        fs.rmSync(binary, { force: true });\n        fs.renameSync(binaryBackup, binary);\n        fs.rmSync(manifest, { force: true });\n        if (fs.existsSync(manifestBackup)) fs.renameSync(manifestBackup, manifest);\n        if (prior) await launchAndVerify(prior.executable === binary ? binary : prior.executable, prior.version, wait);\n      } catch (rollbackError) {\n        throw new Error(`${failure} Rollback failed: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);\n      }\n      throw new Error(`${failure} Previous Meta-Proxy ${prior ? 'was restored and verified' : 'binary was restored; it was not running before the upgrade'}.`);\n    }\n    throw error;\n  } finally {\n    fs.rmSync(binaryBackup, { force: true });\n    fs.rmSync(manifestBackup, { force: true });\n    release?.();\n  }\n}\n","sourceCodeStart":162,"sourceCodeEnd":191,"githubUrl":"https://github.com/ruvnet/ruflo/blob/29f048fc3b556f857cf2b126d2a84c19d2daa0d0/v3/@claude-flow/cli/src/proxy/activation.ts#L162-L191","documentation":"When installAndActivateProxy() fails after it had backed up the existing meta-proxy binary, it attempts a rollback (restore old binary/manifest, relaunch the previous daemon). If any rollback step itself throws — stopping the new daemon, restoring files, or relaunching the prior daemon — the original failure is rethrown wrapped with 'Rollback failed: <rollback error>' so both causes are visible.","triggerScenarios":"An install failure occurs with a backup present (e.g. launchAndVerify of the new version failed), and then rollback also fails — commonly the relaunch of the prior daemon times out (prior exit didn't complete / port busy), or file restore fails (EBUSY/EPERM on Windows, read-only filesystem).","commonSituations":"Old daemon can't restart because its binary was partially replaced; Windows file locks prevent rename while a process holds the .exe; disk full during restore; the pre-upgrade daemon can't come back up for the same environmental reasons the new one failed (config, permissions, supervisor interference).","solutions":["Read both messages in the error: the first clause is why the upgrade failed, the 'Rollback failed' clause is why restore failed — fix the rollback cause first (often relaunch timeout)","Manually restore: move <binary>.rollback back over the binary (and manifest if present), then start meta-proxy by hand and verify /version","Check the daemon log (proxyLogFilePath()) and free resources (disk space, file locks) before retrying the install","On Windows, close processes holding meta-proxy.exe (tasklist /m, or a reboot) so the rename can succeed, then retry"],"exampleFix":"// manual recovery after rollback failure\nmv ~/.metaharness/bin/meta-proxy.rollback ~/.metaharness/bin/meta-proxy\n~/.metaharness/bin/meta-proxy &","handlingStrategy":"try-catch","validationCode":"// Snapshot state so you can recover manually if rollback itself fails\nimport { createHash } from 'node:crypto';\nconst bin = proxyBinaryPath();\nconst sha = fs.existsSync(bin) ? createHash('sha256').update(fs.readFileSync(bin)).digest('hex') : null;\nfs.writeFileSync('/tmp/meta-proxy-preupgrade.json', JSON.stringify({ bin, sha, ts: Date.now() }));","typeGuard":"null","tryCatchPattern":"try {\n  await installAndActivateProxy(version);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Rollback failed')) {\n    // both causes are embedded: root failure + rollback failure; recover manually\n    console.error(e.message);\n    console.error(`Manually restore ${proxyBinaryPath()}.rollback if present`);\n  } else throw e;\n}","preventionTips":["Ensure free disk space and no external file locks (esp. Windows) before upgrading","Stop supervisors from holding/replacing the binary during the upgrade window","Take your own backup of the binary/manifest as a second line of defense","Fix the root-cause class (startup failures, network) first — rollback fails for the same environmental reasons"],"tags":["rollback","install","upgrade","proxy"],"backgroundTag":"upgrade-rollback-failed","analyzedSha":"29f048fc3b556f857cf2b126d2a84c19d2daa0d0","analyzedAt":"2026-09-01T11:37:30.251Z","contentChangedAt":"2026-09-01T11:37:30.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}