Skip to content

Bug: Database initialization fails - "no such table: messages" #55

@HatcherZhao

Description

@HatcherZhao

Summary

Open Cowork Windows installer version 3.3.0-beta.1 fails to start due to incomplete database initialization. Only the sessions table is created, but the messages table is
missing.

Environment

  • OS: Windows 11 Pro 10.0.22621
  • App Version: 3.3.0-beta.1
  • Electron Version: 31.7.7
  • Node Version: v20.18.0
  • Installation Type: Windows Installer (Open Cowork.exe)

Steps to Reproduce

  1. Install Open Cowork using the Windows installer
  2. Launch Open Cowork.exe
  3. Application fails to start with error popup

Error Log

[ERROR] [Database] Schema initialization failed: {
"name": "SqliteError",
"message": "no such table: messages",
"stack": "SqliteError: no such table: messages
at Database.exec (C:\Program Files\Open Cowork\resources\app.asar\node_modules\better-sqlite3\lib\methods\wrappers.js:9:14)
at aR (C:\Program Files\Open Cowork\resources\app.asar\dist-electron\main\index-DUf2hfWR.js:107:196)
..."
}

Root Cause Analysis

After deleting cowork.db and restarting, the app only creates the sessions table. The messages, trace_steps, memory_entries, and skills tables are not created during
initialization.

The initializeSchema() function in src/main/db/database.ts should create all tables, but something interrupts the process after the sessions table is created.

Workaround

Manually creating the missing tables fixes the issue:
CREATE TABLE IF NOT EXISTS messages (...);
CREATE TABLE IF NOT EXISTS trace_steps (...);
CREATE TABLE IF NOT EXISTS memory_entries (...);
CREATE TABLE IF NOT EXISTS skills (...);
-- plus indexes

After manual table creation, the app starts successfully.

Expected Behavior

All required tables should be created during database initialization on first startup.

Actual Behavior

Only sessions table is created; other tables are missing, causing startup failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-feedbackFix shipped, waiting for reporter confirmation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions