{"record":{"id":"cbb2d7758d8870b9","repo":"FlowiseAI/Flowise","slug":"error-creating-this-tablename-table-cbb2d7","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/SQLiteAgentMemory/sqliteSaver.ts","lineNumber":60,"sourceCode":"        if (this.isSetup) {\n            return\n        }\n\n        try {\n            const queryRunner = dataSource.createQueryRunner()\n            const tableName = this.sanitizeTableName(this.tableName)\n            await queryRunner.manager.query(`\nCREATE TABLE IF NOT EXISTS ${tableName} (\n    thread_id TEXT NOT NULL,\n    checkpoint_id TEXT NOT NULL,\n    parent_id TEXT,\n    checkpoint BLOB,\n    metadata BLOB,\n    PRIMARY KEY (thread_id, checkpoint_id));`)\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        if (checkpoint_id) {\n            try {\n                const queryRunner = dataSource.createQueryRunner()\n                const keys = [thread_id, checkpoint_id]\n                const sql = `SELECT checkpoint, parent_id, metadata FROM ${tableName} WHERE thread_id = ? AND checkpoint_id = ?`","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/memory/AgentMemory/SQLiteAgentMemory/sqliteSaver.ts#L42-L78","documentation":"Thrown by SQLiteSaver.setup() when the CREATE TABLE IF NOT EXISTS DDL (with BLOB columns for checkpoint/metadata) fails. The underlying error is logged and re-thrown opaquely. Runs once per instance on first access.","triggerScenarios":"First checkpoint op when: the SQLite file path is not writable, the directory does not exist, the DB file is locked/corrupt, the tableName was rejected by sanitizeTableName earlier in the same call (rethrow path), or TypeORM better-sqlite3 driver mismatch.","commonSituations":"DATABASE_PATH points to a read-only or non-existent directory. Permissions issue in containerised deployments (mounted volume owned by root). File locked by another process. better-sqlite3 native module version mismatch.","solutions":["Check the console.error line for the real SQLite error (SQLITE_CANTOPEN, SQLITE_BUSY, SQLITE_READONLY, native module errors).","Ensure DATABASE_PATH (or ~/.flowise) exists and is writable by the Flowise process.","Close other processes holding the SQLite file, or move to WAL mode via additionalConfig if busy-locking recurs.","Rebuild better-sqlite3 against the running Node version if you see native-module errors.","Maintainer: rethrow with cause."],"exampleFix":"// before\n} catch (error) {\n    console.error(`Error creating ${this.tableName} table`, error)\n    throw new Error(`Error creating ${this.tableName} table`)\n}\n// after\n} catch (error) {\n    throw new Error(`Error creating ${this.tableName} table: ${(error as Error).message}`, { cause: error })\n}","handlingStrategy":"try-catch","validationCode":"import fs from 'fs'\nimport path from 'path'\nfunction ensureSqliteDir(dbPath: string): void {\n  const dir = path.dirname(dbPath)\n  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })\n  fs.accessSync(dir, fs.constants.W_OK)\n}\n// call ensureSqliteDir(database) before constructing SQLiteSaver","typeGuard":"function isSetupError(e: unknown, tableName: string): boolean {\n  return e instanceof Error && e.message === `Error creating ${tableName} table`\n}","tryCatchPattern":"try {\n  await sqliteSaver.getTuple(config)\n} catch (e) {\n  if (e instanceof Error && /Error creating .* table/.test(e.message)) {\n    // check filesystem perms, dir existence, native module health via server log\n  }\n  throw e\n}","preventionTips":["Mount/check DATABASE_PATH as writable by the Flowise user in containers.","Pre-create the SQLite directory at install time.","Pin better-sqlite3 to a version built for your Node runtime."],"tags":["sqlite","ddl","filesystem","permissions","error-masking"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}