paperclipai/paperclip · error

Failed to roll back environment customImage template

Error message

Failed to roll back environment customImage template

What it means

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.

Source

Thrown at server/src/services/environment-custom-images.ts:1283

          .set({
            status: "superseded",
            supersededByTemplateId: previousRow.id,
            updatedAt: now,
          })
          .where(eq(environmentCustomImageTemplates.id, active.id))
          .returning();
        const [nextActive] = await tx
          .update(environmentCustomImageTemplates)
          .set({
            status: "active",
            supersededByTemplateId: null,
            updatedAt: now,
          })
          .where(eq(environmentCustomImageTemplates.id, previousRow.id))
          .returning();
        return [nextSuperseded, nextActive] as const;
      });
      if (!supersededRow || !activeRow) throw new Error("Failed to roll back environment customImage template");
      return {
        activeTemplate: environmentCustomImageTemplateFromRow(activeRow),
        supersededTemplate: environmentCustomImageTemplateFromRow(supersededRow),
      };
    },

    disableTemplate: async (input: {
      environmentId: string;
      deleteProviderTemplate?: boolean;
      now?: Date;
    }): Promise<EnvironmentCustomImageTemplate> => {
      await requireEnvironment(input.environmentId);
      const active = await resolveActiveTemplate(db, input);
      if (!active) throw notFound("Active environment customImage template not found");
      const deleteProvider = input.deleteProviderTemplate
        ? await resolveTemplateDeleteProvider(active)
        : null;
      const now = input.now ?? new Date();

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Inspect server logs for the rollback failure and manually reconcile the environment customImage template state.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/environment-custom-images.ts:1215 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18). Data as JSON: /api/errors/0ef91523901ca1f4. Report an issue: GitHub.