{"record":{"id":"0ef91523901ca1f4","repo":"paperclipai/paperclip","slug":"failed-to-roll-back-environment-customimage-templa","errorCode":null,"errorMessage":"Failed to roll back environment customImage template","messagePattern":"Failed to roll back environment customImage template","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/src/services/environment-custom-images.ts","lineNumber":1283,"sourceCode":"          .set({\n            status: \"superseded\",\n            supersededByTemplateId: previousRow.id,\n            updatedAt: now,\n          })\n          .where(eq(environmentCustomImageTemplates.id, active.id))\n          .returning();\n        const [nextActive] = await tx\n          .update(environmentCustomImageTemplates)\n          .set({\n            status: \"active\",\n            supersededByTemplateId: null,\n            updatedAt: now,\n          })\n          .where(eq(environmentCustomImageTemplates.id, previousRow.id))\n          .returning();\n        return [nextSuperseded, nextActive] as const;\n      });\n      if (!supersededRow || !activeRow) throw new Error(\"Failed to roll back environment customImage template\");\n      return {\n        activeTemplate: environmentCustomImageTemplateFromRow(activeRow),\n        supersededTemplate: environmentCustomImageTemplateFromRow(supersededRow),\n      };\n    },\n\n    disableTemplate: async (input: {\n      environmentId: string;\n      deleteProviderTemplate?: boolean;\n      now?: Date;\n    }): Promise<EnvironmentCustomImageTemplate> => {\n      await requireEnvironment(input.environmentId);\n      const active = await resolveActiveTemplate(db, input);\n      if (!active) throw notFound(\"Active environment customImage template not found\");\n      const deleteProvider = input.deleteProviderTemplate\n        ? await resolveTemplateDeleteProvider(active)\n        : null;\n      const now = input.now ?? new Date();","sourceCodeStart":1265,"sourceCodeEnd":1301,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/services/environment-custom-images.ts#L1265-L1301","documentation":"Rollback failure sentinel in the environment custom-image template service: while promoting a previous template back to 'active' (superseding the current one), the transactional rollback update itself failed. The error marks that the customImage template state could not be restored, leaving template status potentially inconsistent for operator inspection.","triggerScenarios":"Thrown at server/src/services/environment-custom-images.ts:1215 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect server logs for the rollback failure and manually reconcile the environment customImage template state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}