clawwork-ai / clawwork-ai/ClawWork
[Bug] DB migration silently swallows errors in ALTER TABLE catch blocks
- Dominant language
- TypeScript
- Stars
- 532
- Forks
- 75
- Avg merge
- 5h 31m
- Merged PRs (30d)
- 1
Description
## Summary
`packages/desktop/src/main/db/index.ts` — several `ALTER TABLE ADD COLUMN` calls use empty `catch {}` blocks:
```typescript
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:
```typescript
} 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
Research direction
Start in packages/desktop/src/main/db/index.ts at the migration section around line 89 and inspect the ALTER TABLE ADD COLUMN catch blocks. Verify that expected duplicate-column errors remain suppressed while other migration errors are logged with the column context; the change is done when no unexpected ALTER TABLE failure is silently ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript
- Domain
- database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100