clawwork-ai/ClawWork

[Bug] DB migration silently swallows errors in ALTER TABLE catch blocks

Open

#215 opened on Mar 31, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (63 forks)github user discovery
area/artifactgood first issuehelp wantedkind/bug

Repository metrics

Stars
 (519 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary

packages/desktop/src/main/db/index.ts — several ALTER TABLE ADD COLUMN calls use empty catch {} blocks:

for (const col of ['session_key TEXT', 'agent_id TEXT', 'run_id TEXT']) {
  try {
    sqlite.exec(\`ALTER TABLE messages ADD COLUMN \${col}\`);
  } catch {}
}

While "duplicate column" errors are expected and safe to ignore, other errors (disk full, permission denied, schema corruption) are also silently swallowed with no logging.

Expected behavior

Only suppress the expected "duplicate column" error, log unexpected ones:

} catch (e: unknown) {
  const msg = e instanceof Error ? e.message : String(e);
  if (!msg.includes('duplicate column')) {
    console.error(\`[db] migration failed for \${col}:\`, msg);
  }
}

Files

  • packages/desktop/src/main/db/index.ts — migration section (line ~89)

Context

Introduced in PR #210.

Contributor guide