diff --git a/packages/client-sync/src/message-processor/detect-thread.js b/packages/client-sync/src/message-processor/detect-thread.js index 82c4cc6ac..7dafb9215 100644 --- a/packages/client-sync/src/message-processor/detect-thread.js +++ b/packages/client-sync/src/message-processor/detect-thread.js @@ -33,6 +33,9 @@ async function findOrBuildByReferences(db, message) { }); } + if (matchingRef && !matchingRef.thread) { + throw new Error(`Reference not properly cleaned up`) + } return matchingRef ? matchingRef.thread : emptyThread(db, {}); }