Sonarly Claude Code 0d7564ada6 IMAP sync broken after entity migration to core schema
https://sonarly.com/issue/23367?type=bug

IMAP email sync fails because commit d3f0162cf5 removed the connected account feature flag, forcing all reads from the core schema where some IMAP accounts were never migrated due to unresolvable accountOwnerId→userWorkspaceId mappings in the 1.20 upgrade command.

Fix: Added null guards for `messageChannel.connectedAccount` at two critical points in the IMAP sync pipeline:

1. **`messaging-message-list-fetch.job.ts`** (line 83-92): After loading the message channel with its `connectedAccount` relation, check if the connected account exists before proceeding. If missing, track the error via the monitoring service and return early. This prevents the crash at line 110 where `messageChannel.connectedAccount.id` would throw on null access.

2. **`messaging-message-list-fetch.service.ts`** (line 100-107): Same guard after re-fetching the fresh message channel following pending action processing. Without this, `freshMessageChannel.connectedAccount` would crash when passed to `validateAndRefreshConnectedAccountAuthentication`.

Both guards follow the exact same pattern as the existing `!messageChannel` null check: track via monitoring service, return early. This ensures the error is observable (operators can query for `connected_account_not_found` events) while preventing the crash that blocks the entire messaging queue worker.

**Important**: This fix prevents the crash but does NOT restore sync for affected accounts. IMAP connected accounts that were skipped during the 1.20 data migration (because their `accountOwnerId` couldn't be resolved to a `userWorkspaceId`) still need to be manually migrated to the core schema. This requires running a data backfill operation — either re-running the upgrade command with fixes for the owner resolution, or manually inserting the missing rows into `core.connectedAccount`.
2026-04-09 12:33:26 +00:00
2025-08-07 17:02:12 +02:00

Twenty logo

The #1 Open-Source CRM

🌐 Website · 📚 Documentation · Roadmap · Discord · Figma


Cover


Installation

See: 🚀 Self-hosting 🖥️ Local Setup

Why Twenty

We built Twenty for three reasons:

CRMs are too expensive, and users are trapped. Companies use locked-in customer data to hike prices. It shouldn't be that way.

A fresh start is required to build a better experience. We can learn from past mistakes and craft a cohesive experience inspired by new UX patterns from tools like Notion, Airtable or Linear.

We believe in open-source and community. Hundreds of developers are already building Twenty together. Once we have plugin capabilities, a whole ecosystem will grow around it.


What You Can Do With Twenty

Please feel free to flag any specific needs you have by creating an issue.

Below are a few features we have implemented to date:

Personalize layouts with filters, sort, group by, kanban and table views

Companies Kanban Views

Customize your objects and fields

Setting Custom Objects

Create and manage permissions with custom roles

Permissions

Automate workflow with triggers and actions

Workflows

Emails, calendar events, files, and more

Other Features


Stack

Thanks

Chromatic Greptile Sentry Crowdin E2B

Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).

Join the Community

Languages
TypeScript 78%
MDX 18.5%
JavaScript 3.1%
Python 0.2%