{"record":{"id":"2a504ce5d1e95973","repo":"FlowiseAI/Flowise","slug":"error-retrieving-tablename-2a504c","errorCode":null,"errorMessage":"Error retrieving ${tableName}","messagePattern":"Error retrieving (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/memory/AgentMemory/SQLiteAgentMemory/sqliteSaver.ts","lineNumber":100,"sourceCode":"\n                if (rows && rows.length > 0) {\n                    return {\n                        config,\n                        checkpoint: (await this.serde.parse(rows[0].checkpoint)) as Checkpoint,\n                        metadata: (await this.serde.parse(rows[0].metadata)) as CheckpointMetadata,\n                        parentConfig: rows[0].parent_id\n                            ? {\n                                  configurable: {\n                                      thread_id,\n                                      checkpoint_id: rows[0].parent_id\n                                  }\n                              }\n                            : undefined\n                    }\n                }\n            } catch (error) {\n                console.error(`Error retrieving ${tableName}`, error)\n                throw new Error(`Error retrieving ${tableName}`)\n            } finally {\n                await dataSource.destroy()\n            }\n        } else {\n            try {\n                const queryRunner = dataSource.createQueryRunner()\n                const keys = [thread_id]\n                const sql = `SELECT thread_id, checkpoint_id, parent_id, checkpoint, metadata FROM ${tableName} WHERE thread_id = ? ORDER BY checkpoint_id DESC LIMIT 1`\n\n                const rows = await queryRunner.manager.query(sql, [...keys])\n                await queryRunner.release()\n\n                if (rows && rows.length > 0) {\n                    return {\n                        config: {\n                            configurable: {\n                                thread_id: rows[0].thread_id,\n                                checkpoint_id: rows[0].checkpoint_id","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/memory/AgentMemory/SQLiteAgentMemory/sqliteSaver.ts#L82-L118","documentation":"Thrown by SQLiteSaver.getTuple() checkpoint_id-present branch when the parameterised SELECT fails. Uses ? placeholder binding. Underlying error logged then re-thrown generically; dataSource.destroy() runs in finally.","triggerScenarios":"Calling getTuple with checkpoint_id set while the table is missing, columns drift, the file is locked at read, or the binding parameters are wrong types.","commonSituations":"Schema drift after Flowise upgrade. SQLite file locked by a long-running writer. Wrong tableName. Empty/undefined thread_id passed through.","solutions":["Inspect console.error for the actual SQLite error code and act on it.","Pre-create or migrate the checkpoints table to match the current DDL (BLOB columns).","Ensure thread_id and checkpoint_id are strings.","Resolve file locking (WAL mode, single-writer discipline).","Maintainer: rethrow with cause."],"exampleFix":"// before\n} catch (error) {\n    console.error(`Error retrieving ${tableName}`, error)\n    throw new Error(`Error retrieving ${tableName}`)\n}\n// after\n} catch (error) {\n    throw new Error(`Error retrieving ${tableName}: ${(error as Error).message}`, { cause: error })\n}","handlingStrategy":"try-catch","validationCode":"function buildGetTupleConfig(threadId: string, checkpointId?: string) {\n  if (!threadId || typeof threadId !== 'string') throw new Error('thread_id must be a non-empty string')\n  if (checkpointId !== undefined && (typeof checkpointId !== 'string' || !checkpointId)) {\n    throw new Error('checkpoint_id must be a non-empty string when provided')\n  }\n  return { configurable: { thread_id: threadId, ...(checkpointId ? { checkpoint_id: checkpointId } : {}) } }\n}","typeGuard":"function isSqliteRetrieveError(e: unknown): boolean {\n  return e instanceof Error && /^Error retrieving .+$/.test(e.message)\n}","tryCatchPattern":"try {\n  const tuple = await sqliteSaver.getTuple(config)\n} catch (e) {\n  if (e instanceof Error && /Error retrieving/.test(e.message)) {\n    // inspect server log; verify table exists, WAL/busy settings, schema freshness\n  }\n  throw e\n}","preventionTips":["Keep the SQLite schema migrated after upgrades.","Use WAL mode and a healthy busy_timeout to reduce read-lock failures.","Surface server logs for the underlying SQLite error code."],"tags":["sqlite","query","read","error-masking","schema-drift"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}