meshmonitor icon indicating copy to clipboard operation
meshmonitor copied to clipboard

[BUG] win x64 app - cant start Meshmonitor any longer ....

Open kokoshell opened this issue 11 months ago • 1 comments

[WARN] ⚠️ COOKIE_SECURE not set - defaulting to false for HTTP compatibility [WARN] If using HTTPS, set COOKIE_SECURE=true for better security [ERROR] ❌ Migration 002 failed: SqliteError: table permissions_new already exists at Database.exec (C:\Users\tester1\AppData\Local\MeshMonitor\dist\node_modules\better-sqlite3\lib\methods\wrappers.js:9:14) at Object.up (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/server/migrations/002_add_channels_permission.js:14:16) at DatabaseService.runChannelsMigration (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:275:31) at DatabaseService.initialize (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:169:14) at new DatabaseService (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:154:14) at file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:3668:16 at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24) at async loadESM (node:internal/process/esm_loader:34:7) at async handleMainPromise (node:internal/modules/run_main:113:12) { code: 'SQLITE_ERROR' } [ERROR] ❌ Failed to run channels permission migration: SqliteError: table permissions_new already exists at Database.exec (C:\Users\tester1\AppData\Local\MeshMonitor\dist\node_modules\better-sqlite3\lib\methods\wrappers.js:9:14) at Object.up (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/server/migrations/002_add_channels_permission.js:14:16) at DatabaseService.runChannelsMigration (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:275:31) at DatabaseService.initialize (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:169:14) at new DatabaseService (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:154:14) at file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:3668:16 at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24) at async loadESM (node:internal/process/esm_loader:34:7) at async handleMainPromise (node:internal/modules/run_main:113:12) { code: 'SQLITE_ERROR' }

node:internal/process/esm_loader:40 internalBinding('errors').triggerUncaughtException( ^ SqliteError: table permissions_new already exists at Database.exec (C:\Users\tester1\AppData\Local\MeshMonitor\dist\node_modules\better-sqlite3\lib\methods\wrappers.js:9:14) at Object.up (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/server/migrations/002_add_channels_permission.js:14:16) at DatabaseService.runChannelsMigration (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:275:31) at DatabaseService.initialize (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:169:14) at new DatabaseService (file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:154:14) at file:///C:/Users/tester1/AppData/Local/MeshMonitor/dist/services/database.js:3668:16 at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24) at async loadESM (node:internal/process/esm_loader:34:7) at async handleMainPromise (node:internal/modules/run_main:113:12) { code: 'SQLITE_ERROR' }

Node.js v20.10.0

kokoshell avatar Dec 18 '25 13:12 kokoshell

Claude finished @sisari's task —— View job


🤖 Automated Triage

Thank you for reporting this issue! This appears to be a database migration failure where migration 002 is attempting to create a temporary table (permissions_new) that already exists, indicating a previous migration attempt was interrupted or failed.

Root Cause Analysis

The error occurs in src/server/migrations/002_add_channels_permission.ts:14 where the migration tries to create a permissions_new table that already exists. This suggests:

  1. A previous migration attempt started but was interrupted before completion
  2. The cleanup process (dropping the temporary table) never executed
  3. The migration tracking flag wasn't set, so the system tries to run it again

Diagnostic Steps

To help resolve this issue, please run the following diagnostic commands:

1. Locate the Database File

# Navigate to your MeshMonitor data directory
cd %LOCALAPPDATA%\MeshMonitor
dir

Expected output: You should see a meshmonitor.db file

2. Check Database Integrity

If you have SQLite tools installed:

sqlite3 meshmonitor.db ".schema permissions"
sqlite3 meshmonitor.db ".schema permissions_new"

Expected output:

  • permissions table should exist
  • permissions_new should either exist (indicating incomplete migration) or not exist

3. Check Migration Status

sqlite3 meshmonitor.db "SELECT * FROM settings WHERE key = 'migration_002_channels_permission';"

Expected output: Should show if migration was marked as completed

4. Backup and Clean Recovery

⚠️ BACKUP FIRST:

copy meshmonitor.db meshmonitor.db.backup

Then try cleaning the stuck migration:

sqlite3 meshmonitor.db "DROP TABLE IF EXISTS permissions_new;"

Alternative Solution: Fresh Start

If the above doesn't work, you can reset your database (⚠️ this will lose all data):

del meshmonitor.db

Documentation References

Please share the outputs from the diagnostic steps, and I'll provide specific guidance based on your database state.

Labels: bug database migration windows


Yeraze avatar Dec 18 '25 13:12 Yeraze