FlowiseAI/Flowise · error · Error
Invalid table name
Error message
Invalid table name
What it means
PostgresSaver.sanitizeTableName uses the same logic as the MySQL saver: trim, lowercase, whitespace->underscore, then require ^[a-zA-Z0-9_]+$. Hyphens, dots, schema prefixes, or unicode throw. Default 'checkpoints' is always safe.
Source
Thrown at packages/components/nodes/memory/AgentMemory/PostgresAgentMemory/pgSaver.ts:28
protected isSetup: boolean
config: SaverOptions
threadId: string
tableName = 'checkpoints'
constructor(config: SaverOptions, serde?: SerializerProtocol<Checkpoint>) {
super(serde)
this.config = config
const { threadId } = config
this.threadId = threadId
}
sanitizeTableName(tableName: string): string {
// Trim and normalize case, turn whitespace into underscores
tableName = tableName.trim().toLowerCase().replace(/\s+/g, '_')
// Validate using a regex (alphanumeric and underscores only)
if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {
throw new Error('Invalid table name')
}
return tableName
}
private async getDataSource(): Promise<DataSource> {
const { datasourceOptions } = this.config
if (!datasourceOptions) {
throw new Error('No datasource options provided')
}
// Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app
if (datasourceOptions.port === 3006) {
throw new Error('Invalid port number')
}
const dataSource = new DataSource(datasourceOptions)
await dataSource.initialize()
return dataSource
}View on GitHub (pinned to abe4a8601a)
Solutions
- Restrict tableName to letters, digits, and underscores.
- Drop the schema prefix (the saver does not support schema-qualified names).
- Keep the default 'checkpoints' unless a custom name is required.
Example fix
// before tableName = 'public.checkpoints' // after tableName = 'checkpoints'
Defensive patterns
Strategy: validation
Validate before calling
function safeTableName(name: string): string {
const cleaned = name.trim().toLowerCase().replace(/\s+/g, '_')
if (!/^[a-z0-9_]+$/.test(cleaned)) throw new Error(`Invalid table name: ${name}`)
return cleaned
}
const tableName = safeTableName(userTableName ?? 'checkpoints') Type guard
function isValidTableName(name: string): boolean {
return /^[A-Za-z0-9_]+$/.test(name.trim().toLowerCase().replace(/\s+/g, '_'))
} Try / catch
try {
saver.sanitizeTableName(userTableName)
} catch (e) {
throw new Error(`Use only letters, digits, underscores (no schema prefix): ${(e as Error).message}`)
} Prevention
- Do not use schema-qualified names (public.x) - the saver does not split schema.
- Avoid hyphens and dots in table names.
- Prefer the default 'checkpoints'.
- Validate names before constructing the saver.
When it happens
Trigger: Overriding tableName to 'public.checkpoints', 'my-checkpoints', or any value containing characters outside [A-Za-z0-9_].
Common situations: Using Postgres schema.table convention (the saver does not split schema); hyphenated names; unicode names.
Related errors
- Invalid table name
- Invalid JSON in the Additional Configuration:
- Invalid JSON in the Additional Configuration:
- Invalid JSON in the Additional Configuration:
- No datasource options provided
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/876741945fac299d.
Report an issue: GitHub.