{"record":{"id":"58af5a345b782ce9","repo":"RocketChat/Rocket.Chat","slug":"failed-to-load-own-data","errorCode":null,"errorMessage":"failed-to-load-own-data","messagePattern":"failed-to-load-own-data","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/services/video-conference/service.ts","lineNumber":87,"sourceCode":"\tprotected name = 'video-conference';\n\n\t// VideoConference.create: Start a video conference using the type and provider specified as arguments\n\tpublic async create(\n\t\t{ type, rid, createdBy, providerName, ...data }: VideoConferenceCreateData,\n\t\tuseAppUser = true,\n\t): Promise<VideoConferenceInstructions> {\n\t\treturn wrapExceptions(async () => {\n\t\t\tconst room = await Rooms.findOneById<Pick<IRoom, '_id' | 't' | 'uids' | 'name' | 'fname'>>(rid, {\n\t\t\t\tprojection: { t: 1, uids: 1, name: 1, fname: 1 },\n\t\t\t});\n\n\t\t\tif (!room) {\n\t\t\t\tthrow new Error('invalid-room');\n\t\t\t}\n\n\t\t\tconst user = await Users.findOneById<IUser>(createdBy);\n\t\t\tif (!user) {\n\t\t\t\tthrow new Error('failed-to-load-own-data');\n\t\t\t}\n\n\t\t\tif (type === 'direct') {\n\t\t\t\tif (!isRoomCompatibleWithVideoConfRinging(room.t, room.uids)) {\n\t\t\t\t\tthrow new Error('type-and-room-not-compatible');\n\t\t\t\t}\n\n\t\t\t\treturn this.startDirect(providerName, user, room, data);\n\t\t\t}\n\n\t\t\tif (type === 'livechat') {\n\t\t\t\treturn this.startLivechat(providerName, user, rid);\n\t\t\t}\n\n\t\t\tconst title = (data as Partial<IGroupVideoConference>).title || room.fname || room.name || '';\n\t\t\treturn this.startGroup(providerName, user, room._id, title, data, useAppUser);\n\t\t}).catch((err) => {\n\t\t\tlogger.error({","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/e4b8178b205510181a96ceefee043d0abcd13e5a/apps/meteor/server/services/video-conference/service.ts#L69-L105","documentation":"Thrown by VideoConferenceService.create when Users.findOneById(createdBy) returns null — the user starting the call cannot be loaded, so the service cannot build the caller identity for messages and ringing. It fires after the room check and before the type-specific branches (direct/livechat/group).","triggerScenarios":"Calling create with a createdBy that is a deleted or nonexistent user id; app-driven flows whose app user was removed; tests passing arbitrary user ids without seeding Users.","commonSituations":"User deactivated/deleted between client load and call start; imported data referencing dropped user ids; passing a client-supplied user id instead of the authenticated one.","solutions":["Verify the user exists (Users.findOneById) before calling create","Always take createdBy from the authenticated context (e.g. this.userId in Meteor methods) rather than client payloads","For app integrations, ensure the provider app's user exists and is not deleted","Seed Users consistently in test fixtures"],"exampleFix":"// before\nawait VideoConfService.create({ type, rid, createdBy, providerName });\n\n// after\nconst user = await Users.findOneById(createdBy, { projection: { _id: 1 } });\nif (!user) throw new Error('failed-to-load-own-data');\nawait VideoConfService.create({ type, rid, createdBy, providerName });","handlingStrategy":"validation","validationCode":"const user = await Users.findOneById(createdBy, { projection: { _id: 1 } });\nif (!user) throw new Meteor.Error('failed-to-load-own-data');","typeGuard":null,"tryCatchPattern":"try {\n  await VideoConfService.create(payload);\n} catch (err) {\n  if (err instanceof Error && err.message === 'failed-to-load-own-data') {\n    // force re-auth / refresh the user record\n  }\n  throw err;\n}","preventionTips":["Take the caller id from the authenticated context, not client payloads","Close active UIs on user-deleted events","Keep room and user fixtures referentially consistent in tests"],"tags":["video-conference","users","lookup"],"backgroundTag":"user-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"}