clawwork-ai/ClawWork

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

Open

#215 aperta il 31 mar 2026

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)TypeScript (63 fork)github user discovery
area/artifactgood first issuehelp wantedkind/bug

Metriche repository

Star
 (519 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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.

Guida contributor