FlowiseAI/Flowise · error · Error

Error creating ${this.tableName} table

Error message

Error creating ${this.tableName} table

What it means

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.

Source

Thrown at packages/components/nodes/memory/AgentMemory/SQLiteAgentMemory/sqliteSaver.ts:60

        if (this.isSetup) {
            return
        }

        try {
            const queryRunner = dataSource.createQueryRunner()
            const tableName = this.sanitizeTableName(this.tableName)
            await queryRunner.manager.query(`
CREATE TABLE IF NOT EXISTS ${tableName} (
    thread_id TEXT NOT NULL,
    checkpoint_id TEXT NOT NULL,
    parent_id TEXT,
    checkpoint BLOB,
    metadata BLOB,
    PRIMARY KEY (thread_id, checkpoint_id));`)
            await queryRunner.release()
        } catch (error) {
            console.error(`Error creating ${this.tableName} table`, error)
            throw new Error(`Error creating ${this.tableName} table`)
        }

        this.isSetup = true
    }

    async getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined> {
        const dataSource = await this.getDataSource()
        await this.setup(dataSource)

        const thread_id = config.configurable?.thread_id || this.threadId
        const checkpoint_id = config.configurable?.checkpoint_id
        const tableName = this.sanitizeTableName(this.tableName)

        if (checkpoint_id) {
            try {
                const queryRunner = dataSource.createQueryRunner()
                const keys = [thread_id, checkpoint_id]
                const sql = `SELECT checkpoint, parent_id, metadata FROM ${tableName} WHERE thread_id = ? AND checkpoint_id = ?`

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Check the console.error line for the real SQLite error (SQLITE_CANTOPEN, SQLITE_BUSY, SQLITE_READONLY, native module errors).
  2. Ensure DATABASE_PATH (or ~/.flowise) exists and is writable by the Flowise process.
  3. Close other processes holding the SQLite file, or move to WAL mode via additionalConfig if busy-locking recurs.
  4. Rebuild better-sqlite3 against the running Node version if you see native-module errors.
  5. Maintainer: rethrow with cause.

Example fix

// before
} catch (error) {
    console.error(`Error creating ${this.tableName} table`, error)
    throw new Error(`Error creating ${this.tableName} table`)
}
// after
} catch (error) {
    throw new Error(`Error creating ${this.tableName} table: ${(error as Error).message}`, { cause: error })
}
Defensive patterns

Strategy: try-catch

Validate before calling

import fs from 'fs'
import path from 'path'
function ensureSqliteDir(dbPath: string): void {
  const dir = path.dirname(dbPath)
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
  fs.accessSync(dir, fs.constants.W_OK)
}
// call ensureSqliteDir(database) before constructing SQLiteSaver

Type guard

function isSetupError(e: unknown, tableName: string): boolean {
  return e instanceof Error && e.message === `Error creating ${tableName} table`
}

Try / catch

try {
  await sqliteSaver.getTuple(config)
} catch (e) {
  if (e instanceof Error && /Error creating .* table/.test(e.message)) {
    // check filesystem perms, dir existence, native module health via server log
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/cbb2d7758d8870b9. Report an issue: GitHub.