#13577·paperclip

Migration 0255 drops tool_connections_transport_check without IF EXISTS, breaking upgrade to 2026.916.0

Author: pnostCreated Sep 17, 2026Updated Sep 17, 2026

Pre-submission checklist

  • I have searched existing open and closed issues and this is not a duplicate.
  • I am on the latest released version of Paperclip (or can reproduce on master).
  • I have confirmed the error originates in Paperclip itself — not in my agent adapter, API provider, or local configuration.

What happened?

Upgrading an existing instance from 2026.831.1 (or 2026.824.1) straight to 2026.916.0 crash-loops the server on startup during the embedded-Postgres migration step. Confirmed this is not a version-jump-size issue: there is no intermediate stable npm release between 2026.831.1 and 2026.916.0, so migrations 02550279 always apply as one batch regardless of upgrade path.

Startup log:

Applying 25 pending migrations for Embedded PostgreSQL
Paperclip server failed to start.
constraint "tool_connections_transport_check" of relation "tool_connections" does not exist

Root cause: @paperclipai/db migration 0255_previous_captain_america.sql contains:

ALTER TABLE "tool_connections" DROP CONSTRAINT "tool_connections_transport_check";
...
ALTER TABLE "tool_connections" ADD CONSTRAINT "tool_connections_transport_check" CHECK ("tool_connections"."transport" in ('mcp_remote', 'rest_api', 'local_stdio', 'chat_sdk'));

The DROP CONSTRAINT has no IF EXISTS guard. On this instance's schema history, tool_connections_transport_check does not exist at the point migration 0255 runs, so the ALTER TABLE ... DROP CONSTRAINT fails outright and aborts the whole migration batch, which then crash-loops the systemd service (paperclipai run) since the doctor/migration step runs on every restart.

This is the same class of bug as #12080 (migration assumes a schema shape the upgrading instance never had) — a DROP CONSTRAINT/DROP COLUMN without IF EXISTS in a migration that isn't guaranteed to be reachable from every upgrade path.

Later in the same migration, migration 0276_hard_mandroid.sql does the equivalent operation correctly:

ALTER TABLE "tool_connections" DROP CONSTRAINT IF EXISTS "tool_connections_transport_check";

so the fix pattern is already established elsewhere in the codebase — 0255 just doesn't follow it.

Environment

  • Platform: Ubuntu 24.04 LTS, arm64 (Oracle Cloud)
  • Install method: npm install -g paperclipai
  • Instance mode: embedded-postgres, authenticated/private, systemd service
  • Upgrade path tried: 2026.824.12026.831.02026.831.12026.916.0 (fails identically whether jumping directly or stepping through intermediate stable releases, since none of them apply migration 0255 in isolation)

Expected behavior

ALTER TABLE "tool_connections" DROP CONSTRAINT "tool_connections_transport_check"; in migration 0255_previous_captain_america.sql should be DROP CONSTRAINT IF EXISTS ..., matching the pattern already used in migration 0276_hard_mandroid.sql, so the migration is idempotent/safe regardless of which prior migration state an instance is upgrading from.

Workaround

Rolled back to 2026.831.1 (last version confirmed healthy on this instance) via npm install -g [email protected].