{"record":{"id":"0314126c665aa35e","repo":"paperclipai/paperclip","slug":"payloadlabel-failed-service-validation-and-was","errorCode":null,"errorMessage":"${payloadLabel} failed service validation and was rolled back to ${rolledBack.version}, but the rolled-back service also failed to restart.","messagePattern":"(.+?) failed service validation and was rolled back to (.+?), but the rolled-back service also failed to restart\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/update.ts","lineNumber":159,"sourceCode":"\nasync function defaultConfirm(message: string): Promise<boolean> {\n  if (!process.stdin.isTTY || !process.stdout.isTTY) return false;\n  const answer = await p.confirm({ message, initialValue: false });\n  return !p.isCancel(answer) && answer === true;\n}\nfunction emit(options: UpdateOptions, value: Record<string, unknown>, message: string): void { if (options.json) console.log(JSON.stringify(value, null, 2)); else console.log(message); }\n\nasync function rollbackAfterServiceValidationFailure(\n  paths: InstallStorePaths,\n  restartActiveService: (expectedVersion: string) => Promise<boolean>,\n  validationError: unknown,\n  payloadLabel: string,\n): Promise<never> {\n  const rolledBack = await withInstallStoreLock(async () => rollbackManagedInstall(paths), paths);\n  try {\n    await restartActiveService(rolledBack.version);\n  } catch (restartError) {\n    throw new Error(\n      `${payloadLabel} failed service validation and was rolled back to ${rolledBack.version}, but the rolled-back service also failed to restart.`,\n      { cause: new AggregateError([validationError, restartError]) },\n    );\n  }\n  throw new Error(`${payloadLabel} failed service validation and was rolled back to ${rolledBack.version}.`, { cause: validationError });\n}\n\nexport async function updateCommand(options: UpdateOptions, overrides: Partial<Dependencies> = {}): Promise<void> {\n  const paths = overrides.paths ?? resolveInstallStorePaths();\n  const executablePath = overrides.executablePath ?? process.argv[1] ?? \"\";\n  const runCommand = overrides.runCommand ?? execFileAsync;\n  const mode = detectInstallMode(executablePath, paths);\n  const manifest = readInstallManifest(paths);\n  if (options.rollback) {\n    if (mode !== \"managed\") throw new Error(\"--rollback is only available for managed installs.\");\n    if (options.dryRun) { emit(options, { mode, action: \"rollback\", dryRun: true, target: manifest?.previous[0]?.version ?? null }, `Would roll back to ${manifest?.previous[0]?.version ?? \"the previous payload\"}.`); return; }\n    const next = await withInstallStoreLock(async () => rollbackManagedInstall(paths), paths);\n    const restarted = await (overrides.restartActiveService ?? restartActiveManagedService)(next.version);","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/update.ts#L141-L177","documentation":"After a failed service validation the install was rolled back, but restarting the rolled-back version also failed; the aggregate error carries both the validation and restart causes.","triggerScenarios":"Thrown at cli/src/commands/update.ts:159 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect service logs for both payloads, fix the underlying startup failure, and reinstall a known-good version."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}