{"record":{"id":"3a721afac38341e5","repo":"FlowiseAI/Flowise","slug":"invalid-table-name","errorCode":null,"errorMessage":"Invalid table name","messagePattern":"Invalid table name","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/memory/AgentMemory/MySQLAgentMemory/mysqlSaver.ts","lineNumber":28,"sourceCode":"    protected isSetup: boolean\n    config: SaverOptions\n    threadId: string\n    tableName = 'checkpoints'\n\n    constructor(config: SaverOptions, serde?: SerializerProtocol<Checkpoint>) {\n        super(serde)\n        this.config = config\n        const { threadId } = config\n        this.threadId = threadId\n    }\n\n    sanitizeTableName(tableName: string): string {\n        // Trim and normalize case, turn whitespace into underscores\n        tableName = tableName.trim().toLowerCase().replace(/\\s+/g, '_')\n\n        // Validate using a regex (alphanumeric and underscores only)\n        if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {\n            throw new Error('Invalid table name')\n        }\n\n        return tableName\n    }\n\n    private async getDataSource(): Promise<DataSource> {\n        const { datasourceOptions } = this.config\n        if (!datasourceOptions) {\n            throw new Error('No datasource options provided')\n        }\n        // Prevent using default Postgres port, otherwise will throw uncaught error and crashing the app\n        if (datasourceOptions.port === 5432) {\n            throw new Error('Invalid port number')\n        }\n        const dataSource = new DataSource(datasourceOptions)\n        await dataSource.initialize()\n        return dataSource\n    }","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/memory/AgentMemory/MySQLAgentMemory/mysqlSaver.ts#L10-L46","documentation":"MySQLSaver.sanitizeTableName trims, lowercases, replaces whitespace with underscores, then requires the result to match ^[a-zA-Z0-9_]+$. Any other character (hyphen, dot, unicode, schema prefix) throws. Default tableName is 'checkpoints', which always passes.","triggerScenarios":"Overriding tableName to a value containing characters outside [A-Za-z0-9_], e.g. 'app.checkpoints', 'my-checkpoints', 'checkpoint_é'.","commonSituations":"Using a schema-qualified or hyphenated table name; copying a Postgres schema.table convention into the MySQL saver; unicode in the name.","solutions":["Restrict tableName to letters, digits, and underscores only.","Replace hyphens/dots with underscores (my_checkpoints).","Leave tableName at the default 'checkpoints' unless a custom name is required."],"exampleFix":"// before\ntableName = 'app.checkpoints'\n// after\ntableName = 'app_checkpoints'","handlingStrategy":"validation","validationCode":"function safeTableName(name: string): string {\n  const cleaned = name.trim().toLowerCase().replace(/\\s+/g, '_')\n  if (!/^[a-z0-9_]+$/.test(cleaned)) throw new Error(`Invalid table name: ${name}`)\n  return cleaned\n}\nconst tableName = safeTableName(userTableName ?? 'checkpoints')","typeGuard":"function isValidTableName(name: string): boolean {\n  return /^[A-Za-z0-9_]+$/.test(name.trim().toLowerCase().replace(/\\s+/g, '_'))\n}","tryCatchPattern":"try {\n  saver.sanitizeTableName(userTableName)\n} catch (e) {\n  throw new Error(`Choose a table name using only letters, digits, underscores: ${(e as Error).message}`)\n}","preventionTips":["Avoid hyphens, dots, and schema prefixes in table names.","Prefer the default 'checkpoints'.","Validate user-supplied table names before constructing the saver.","Lowercase names to avoid MySQL case-sensitivity surprises."],"tags":["mysql","agent-memory","validation","sql","table-name","memory"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}