Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: report "LibsqlError: SQLITE_BUSY: database is locked" when use local storage #218

Open
longyiwu opened this issue Feb 1, 2025 · 1 comment
Labels
bug Something isn't working triage

Comments

@longyiwu
Copy link

longyiwu commented Feb 1, 2025

Expected Behaviour

i am using typescript sdk in electron main process. expect local storage work.

Current Behaviour

report error:
Error saving message: LibsqlError: SQLITE_BUSY: database is locked
at mapSqliteError (/Users/sammax/code/js/mindfloweditor/node_modules/@libsql/client/lib-cjs/sqlite3.js:396:16)
at executeStmt (/Users/sammax/code/js/mindfloweditor/node_modules/@libsql/client/lib-cjs/sqlite3.js:301:15)
at Sqlite3Client.transaction (/Users/sammax/code/js/mindfloweditor/node_modules/@libsql/client/lib-cjs/sqlite3.js:147:9)
... 3 lines matching cause stack trace ...
at async MultiAgentOrchestrator.processStreamInBackground (/Users/sammax/code/js/mindfloweditor/node_modules/multi-agent-orchestrator/dist/orchestrator.js:208:21) {
code: 'SQLITE_BUSY',
rawCode: 5,
[cause]: SqliteError: database is locked
at convertError (/Users/sammax/code/js/mindfloweditor/node_modules/libsql/index.js:51:12)
at Statement.run (/Users/sammax/code/js/mindfloweditor/node_modules/libsql/index.js:301:13)
at executeStmt (/Users/sammax/code/js/mindfloweditor/node_modules/@libsql/client/lib-cjs/sqlite3.js:294:34)
at Sqlite3Client.transaction (/Users/sammax/code/js/mindfloweditor/node_modules/@libsql/client/lib-cjs/sqlite3.js:147:9)
at SqlChatStorage.saveChatMessage (/Users/sammax/code/js/mindfloweditor/node_modules/multi-agent-orchestrator/dist/storage/sqlChatStorage.js:52:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async saveConversationExchange (/Users/sammax/code/js/mindfloweditor/node_modules/multi-agent-orchestrator/dist/utils/chatUtils.js:15:5)
at async MultiAgentOrchestrator.processStreamInBackground (/Users/sammax/code/js/mindfloweditor/node_modules/multi-agent-orchestrator/dist/orchestrator.js:208:21)

Code snippet

const dbPath = path.join(userDataPath, 'database', 'local.db');
            console.log("chat dbPath:", dbPath)
            const dbUrl = `file:${dbPath}`;
            const localStorage = new SqlChatStorage(dbUrl);
            await localStorage.waitForInitialization();

            const writerClassifier = new KeywordClassifier({ "aaa": "test" });
            this.orchestrator = new MultiAgentOrchestrator({
                classifier: writerClassifier,
                storage:localStorage
            });

Possible Solution

No response

Steps to Reproduce

  1. create a electron project
  2. write code in main progress and ipc handler
  3. call routeRequest method
  4. get error message
@longyiwu longyiwu added the bug Something isn't working label Feb 1, 2025
@github-actions github-actions bot added the triage label Feb 1, 2025
@cornelcroi cornelcroi reopened this Feb 3, 2025
@cornelcroi
Copy link
Contributor

@Rajaniraiyn Can you have a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants