{"record":{"id":"a6153ad3adeb2664","repo":"RocketChat/Rocket.Chat","slug":"video-conf-data-not-found","errorCode":null,"errorMessage":"video-conf-data-not-found","messagePattern":"video-conf-data-not-found","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"warning","filePath":"apps/meteor/server/services/video-conference/service.ts","lineNumber":1036,"sourceCode":"\t\t\tthrow new Error('video-conf-data-not-found');\n\t\t}\n\n\t\tif (!videoConfTypes.isCallManagedByApp(call)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!videoConfProviders.isProviderAvailable(call.providerName)) {\n\t\t\tthrow new Error('video-conf-provider-unavailable');\n\t\t}\n\n\t\treturn (await this.getProviderManager()).onNewVideoConference(call.providerName, call);\n\t}\n\n\tprivate async runVideoConferenceChangedEvent(callId: VideoConference['_id']): Promise<void> {\n\t\tconst call = await VideoConferenceModel.findOneById(callId);\n\n\t\tif (!call) {\n\t\t\tthrow new Error('video-conf-data-not-found');\n\t\t}\n\n\t\tif (!videoConfTypes.isCallManagedByApp(call)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!videoConfProviders.isProviderAvailable(call.providerName)) {\n\t\t\tthrow new Error('video-conf-provider-unavailable');\n\t\t}\n\n\t\treturn (await this.getProviderManager()).onVideoConferenceChanged(call.providerName, call);\n\t}\n\n\tprivate async runOnUserJoinEvent(callId: VideoConference['_id'], user?: IVideoConferenceUser): Promise<void> {\n\t\tconst call = await VideoConferenceModel.findOneById(callId);\n\n\t\tif (!call) {\n\t\t\tthrow new Error('video-conf-data-not-found');","sourceCodeStart":1018,"sourceCodeEnd":1054,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/services/video-conference/service.ts#L1018-L1054","documentation":"Thrown by runVideoConferenceChangedEvent() when VideoConferenceModel.findOneById(callId) returns null while trying to dispatch the call-changed event to the provider app. The call document no longer exists: it was deleted between the action that triggers the event and this re-read - calls are routinely removed after ending, and app handlers or cleanup jobs can delete them mid-flight.","triggerScenarios":"Two flows race: one updates or ends the call (triggering the changed event) while another has already deleted the document; app code deletes the call and then a status update fires the changed event; housekeeping pruning of ended calls interleaves with an update.","commonSituations":"A user ends a call exactly as another participant's action triggers a call-changed callback; provider apps that delete call records; scheduled cleanup jobs racing in-flight events.","solutions":["Treat as a benign race when the call was just ended: verify the call's absence is expected and skip the event","Audit app handlers and cleanup jobs that delete call documents and serialize them with event dispatch","When dispatching events, read the call once and pass the document instead of re-reading by id","Log the callId at the deletion site to identify who removed it"],"exampleFix":"// before\nconst call = await VideoConferenceModel.findOneById(callId);\nif (!call) throw new Error('video-conf-data-not-found');\n\n// after\nconst call = await VideoConferenceModel.findOneById(callId);\nif (!call) {\n\tlogger.debug(`call ${callId} vanished before changed event; skipping`);\n\treturn; // call already ended/deleted - event is moot\n}","handlingStrategy":"try-catch","validationCode":"const call = await VideoConferenceModel.findOneById(callId);\nif (!call) {\n\t// call already ended or deleted - skip dispatching its changed event\n\treturn;\n}","typeGuard":null,"tryCatchPattern":"try {\n\tawait runVideoConferenceChangedEvent(callId);\n} catch (err) {\n\tif (err instanceof Error && err.message === 'video-conf-data-not-found') return; // benign race\n\tthrow err;\n}","preventionTips":["Read the call once and pass the document to event dispatch instead of re-reading by id","Serialize call deletion with event dispatch (queue per callId)","Treat 'not found' on changed events as expected when the call just ended"],"tags":["video-conference","race-condition","event-dispatch","record-deleted"],"backgroundTag":"record-not-found","analyzedSha":"e4b8178b205510181a96ceefee043d0abcd13e5a","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}