{"record":{"id":"84a062506573ce5c","repo":"FlowiseAI/Flowise","slug":"error-saving-checkpoint-84a062","errorCode":null,"errorMessage":"Error saving checkpoint","messagePattern":"Error saving checkpoint","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/memory/AgentMemory/SQLiteAgentMemory/sqliteSaver.ts","lineNumber":213,"sourceCode":"\n        if (!config.configurable?.checkpoint_id) return {}\n        try {\n            const queryRunner = dataSource.createQueryRunner()\n            const row = [\n                config.configurable?.thread_id || this.threadId,\n                checkpoint.id,\n                config.configurable?.checkpoint_id,\n                this.serde.stringify(checkpoint),\n                this.serde.stringify(metadata)\n            ]\n            const tableName = this.sanitizeTableName(this.tableName)\n            const query = `INSERT OR REPLACE INTO ${tableName} (thread_id, checkpoint_id, parent_id, checkpoint, metadata) VALUES (?, ?, ?, ?, ?)`\n\n            await queryRunner.manager.query(query, row)\n            await queryRunner.release()\n        } catch (error) {\n            console.error('Error saving checkpoint', error)\n            throw new Error('Error saving checkpoint')\n        } finally {\n            await dataSource.destroy()\n        }\n\n        return {\n            configurable: {\n                thread_id: config.configurable?.thread_id || this.threadId,\n                checkpoint_id: checkpoint.id\n            }\n        }\n    }\n\n    async delete(threadId: string): Promise<void> {\n        if (!threadId) {\n            return\n        }\n\n        const dataSource = await this.getDataSource()","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/memory/AgentMemory/SQLiteAgentMemory/sqliteSaver.ts#L195-L231","documentation":"Thrown by SQLiteSaver.put() when the INSERT OR REPLACE upsert into the checkpoints table fails. Underlying error logged then re-thrown generically; finally destroys dataSource.","triggerScenarios":"put() with checkpoint_id present while the table is missing, schema drifted (non-BLOB columns), payload too large, file locked, or role/FS permissions issue.","commonSituations":"Schema drift after upgrade. SQLite busy/locked under concurrent writes. Filesystem read-only. Very large serialized checkpoints.","solutions":["Check console.error for the real SQLite error (SQLITE_BUSY, SQLITE_READONLY, SQL logic error, etc.).","Recreate the checkpoints table to match current DDL.","Enable WAL mode and raise busy_timeout via additionalConfig to mitigate write contention.","Ensure the DB file/dir is writable.","Maintainer: rethrow with cause."],"exampleFix":"// before\n} catch (error) {\n    console.error('Error saving checkpoint', error)\n    throw new Error('Error saving checkpoint')\n}\n// after\n} catch (error) {\n    throw new Error(`Error saving checkpoint: ${(error as Error).message}`, { cause: error })\n}","handlingStrategy":"try-catch","validationCode":"function assertCheckpointWritable(checkpoint: { id?: unknown }, config: { configurable?: { checkpoint_id?: unknown } }) {\n  if (!config.configurable?.checkpoint_id) throw new Error('put() requires config.configurable.checkpoint_id')\n  if (typeof checkpoint.id !== 'string' || !checkpoint.id) throw new Error('checkpoint.id must be a non-empty string')\n}","typeGuard":"function isSqliteSaveError(e: unknown): boolean {\n  return e instanceof Error && e.message === 'Error saving checkpoint'\n}","tryCatchPattern":"try {\n  await sqliteSaver.put(config, checkpoint, metadata)\n} catch (e) {\n  if (e instanceof Error && e.message === 'Error saving checkpoint') {\n    // inspect log for SQLITE_BUSY/READONLY; enable WAL; verify schema BLOB columns\n  }\n  throw e\n}","preventionTips":["Enable WAL and set busy_timeout in additionalConfig for write-heavy workloads.","Keep the SQLite file/dir writable by the Flowise process.","Migrate the checkpoints schema after upgrades."],"tags":["sqlite","write","upsert","error-masking","schema-drift"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}