{"record":{"id":"8b6790c3d0299747","repo":"FlowiseAI/Flowise","slug":"error-creating-this-tablename-table","errorCode":null,"errorMessage":"Error creating ${this.tableName} table","messagePattern":"Error creating (.+?) table","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/memory/AgentMemory/MySQLAgentMemory/mysqlSaver.ts","lineNumber":66,"sourceCode":"    private async setup(dataSource: DataSource): Promise<void> {\n        if (this.isSetup) return\n\n        try {\n            const queryRunner = dataSource.createQueryRunner()\n            const tableName = this.sanitizeTableName(this.tableName)\n            await queryRunner.manager.query(`\n                CREATE TABLE IF NOT EXISTS ${tableName} (\n                    thread_id VARCHAR(255) NOT NULL,\n                    checkpoint_id VARCHAR(255) NOT NULL,\n                    parent_id VARCHAR(255),\n                    checkpoint BLOB,\n                    metadata BLOB,\n                    PRIMARY KEY (thread_id, checkpoint_id)\n                );`)\n            await queryRunner.release()\n        } catch (error) {\n            console.error(`Error creating ${this.tableName} table`, error)\n            throw new Error(`Error creating ${this.tableName} table`)\n        }\n\n        this.isSetup = true\n    }\n\n    async getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined> {\n        const dataSource = await this.getDataSource()\n        await this.setup(dataSource)\n\n        const thread_id = config.configurable?.thread_id || this.threadId\n        const checkpoint_id = config.configurable?.checkpoint_id\n        const tableName = this.sanitizeTableName(this.tableName)\n\n        try {\n            const queryRunner = dataSource.createQueryRunner()\n            const sql = checkpoint_id\n                ? `SELECT checkpoint, parent_id, metadata FROM ${tableName} WHERE thread_id = ? AND checkpoint_id = ?`\n                : `SELECT thread_id, checkpoint_id, parent_id, checkpoint, metadata FROM ${tableName} WHERE thread_id = ? ORDER BY checkpoint_id DESC LIMIT 1`","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/memory/AgentMemory/MySQLAgentMemory/mysqlSaver.ts#L48-L84","documentation":"MySQLSaver.setup runs CREATE TABLE IF NOT EXISTS; any underlying DB error is logged via console.error (original stack visible there) and re-thrown as this generic message using the raw this.tableName (not the sanitized value).","triggerScenarios":"DB user lacks CREATE privilege; connection dropped mid-DDL; an existing table with an incompatible schema; disk/full quota; MySQL version rejecting the DDL.","commonSituations":"Read-only DB role; table created by an older Flowise version with a different schema; exhausted database storage; flaky connection during setup.","solutions":["Inspect server/console logs for the original error (console.error prints it before the re-throw).","Grant CREATE (and ALTER) to the DB user, or use a privileged role for setup.","Drop the conflicting checkpoints table if schema drifted, then let setup recreate it.","Verify DB connectivity/storage before re-running."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm CREATE privilege and connectivity\nasync function canCreate(ds: import('typeorm').DataSource): Promise<boolean> {\n  const qr = ds.createQueryRunner()\n  try { await qr.query('SELECT 1'); return true } finally { await qr.release() }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await saver.getTuple(config)\n} catch (e) {\n  if (/Error creating .* table/.test((e as Error).message)) {\n    // check server logs for the original DDL error; grant privileges or fix schema\n  }\n  throw e\n}","preventionTips":["Use a DB role with CREATE/ALTER for first run (setup only).","Pre-create the checkpoints table if the runtime role must be read/write-only.","Watch console.error output for the underlying cause.","Lock the table schema across Flowise versions to avoid drift."],"tags":["mysql","agent-memory","database","schema","ddl","memory"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}