paperclipai/paperclip · error · Error
Plugin SQL cannot mutate or define objects in public.${ref.t
Error message
Plugin SQL cannot mutate or define objects in public.${ref.table} What it means
Companion guard to the public-read whitelist: the whitelisted public table is referenced with a mutating/defining keyword (anything beyond from/join/references), so the plugin would write to or define objects on core tables. The plugin statement's use of the table is at fault.
Source
Thrown at server/src/services/plugin-database.ts:166
refs.push({ keyword: match[1]!.toLowerCase(), schema: match[2]!, table: match[3]! });
} else {
refs.push({ keyword: mapping.keyword, schema: match[1]!, table: match[2]! });
}
}
}
return refs;
}
function assertAllowedPublicRead(
ref: SqlRef,
allowedCoreReadTables: ReadonlySet<string>,
): void {
if (ref.schema !== "public") return;
if (!allowedCoreReadTables.has(ref.table)) {
throw new Error(`Plugin SQL references public.${ref.table}, which is not whitelisted`);
}
if (!["from", "join", "references"].includes(ref.keyword)) {
throw new Error(`Plugin SQL cannot mutate or define objects in public.${ref.table}`);
}
}
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));View on GitHub (pinned to 120ae5428f)
Solutions
- Remove mutations/DDL against the public table from the plugin SQL; plugin SQL cannot change public schema objects.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/plugin-database.ts:166 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/abe229455df5904d.
Report an issue: GitHub.