paperclipai/paperclip · error · Error
Plugin migrations may contain DDL or namespace-scoped backfi
Error message
Plugin migrations may contain DDL or namespace-scoped backfill statements only
What it means
Statement-shape guard in validatePluginMigrationStatement: the statement is not DDL (create/alter/comment), not a backfill (insert into/update), and not a CTE ending in insert/update. Arbitrary statement types (e.g. raw select scripts, pragma, transactions) are rejected so migration effects stay predictable; the off-spec migration statement is at fault.
Source
Thrown at server/src/services/plugin-database.ts:212
): void {
assertIdentifier(namespace, "namespace");
assertNoBannedSql(statement);
const normalized = normaliseSql(statement);
if (/^\s*(drop|truncate)\b/.test(normalized)) {
throw new Error("Destructive plugin migrations are not allowed in Phase 1");
}
if (/\bdelete\s+from\b/.test(normalized)) {
throw new Error("Plugin migrations cannot delete data");
}
const ddlOrBackfillAllowed =
/^(create|alter|comment)\b/.test(normalized) ||
/^(insert\s+into|update)\b/.test(normalized) ||
(normalized.startsWith("with ") && /\b(insert\s+into|update)\b/.test(normalized));
if (!ddlOrBackfillAllowed) {
throw new Error("Plugin migrations may contain DDL or namespace-scoped backfill statements only");
}
const refs = extractQualifiedRefs(statement);
if (refs.length === 0 && !normalized.startsWith("comment ")) {
throw new Error("Plugin migration objects must use fully qualified schema names");
}
const objectRefKeywords = new Set([
"alter table",
"create index",
"create table",
"create view",
"drop table",
"into",
"truncate table",
"update",
]);
const hasQualifiedObjectRef = refs.some((ref) => objectRefKeywords.has(ref.keyword));View on GitHub (pinned to 120ae5428f)
Solutions
- Restrict the migration to DDL or namespace-scoped backfill statements only.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/plugin-database.ts:212 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/c021238631160fcd.
Report an issue: GitHub.