paperclipai/paperclip · error · Error

Plugin SQL contains a disallowed statement or clause: ${matc

Error message

Plugin SQL contains a disallowed statement or clause: ${matched.source}

What it means

Ban-list guard (assertNoBannedSql): the normalized plugin SQL matched one of the prohibited patterns (create extension/trigger/function/language, grant, revoke, security definer, copy, call, do-blocks). These constructs let plugins escalate privileges or execute arbitrary host-side logic; the matched regex source is embedded in the message.

Source

Thrown at server/src/services/plugin-database.ts:186

}

function assertNoBannedSql(statement: string): void {
  const normalized = normaliseSql(statement);
  const banned = [
    /\bcreate\s+extension\b/,
    /\bcreate\s+(?:event\s+)?trigger\b/,
    /\bcreate\s+(?:or\s+replace\s+)?function\b/,
    /\bcreate\s+language\b/,
    /\bgrant\b/,
    /\brevoke\b/,
    /\bsecurity\s+definer\b/,
    /\bcopy\b/,
    /\bcall\b/,
    /\bdo\s+(?:\$\$|language\b)/,
  ];
  const matched = banned.find((pattern) => pattern.test(normalized));
  if (matched) {
    throw new Error(`Plugin SQL contains a disallowed statement or clause: ${matched.source}`);
  }
}

export function validatePluginMigrationStatement(
  statement: string,
  namespace: string,
  coreReadTables: readonly PluginDatabaseCoreReadTable[] = [],
): 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");

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Remove the disallowed statement or clause named in the message from the plugin SQL.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/plugin-database.ts:186 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/f09937a3d249ac7e. Report an issue: GitHub.