{"record":{"id":"b3b74b29936e6306","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-inquiry-b3b74b","errorCode":null,"errorMessage":"error-invalid-inquiry","messagePattern":"error-invalid-inquiry","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/local-services/omnichannel.internalService.ts","lineNumber":107,"sourceCode":"\t\tif (!room.open) {\n\t\t\tthrow new Error('This_conversation_is_already_closed');\n\t\t}\n\n\t\tif (!room.onHold) {\n\t\t\tthrow new Error('error-room-not-on-hold');\n\t\t}\n\n\t\tconst { _id: roomId, servedBy } = room;\n\n\t\tif (!servedBy) {\n\t\t\tthis.logger.error({ msg: 'No serving agent found for room', roomId });\n\t\t\tthrow new Error('error-room-not-served');\n\t\t}\n\n\t\tconst inquiry = await LivechatInquiry.findOneByRoomId(roomId, {});\n\t\tif (!inquiry) {\n\t\t\tthis.logger.error({ msg: 'No inquiry found for room', roomId });\n\t\t\tthrow new Error('error-invalid-inquiry');\n\t\t}\n\n\t\tawait this.attemptToAssignRoomToServingAgentElseQueueIt({\n\t\t\troom,\n\t\t\tinquiry,\n\t\t\tservingAgent: servedBy,\n\t\t\tclientAction,\n\t\t});\n\n\t\tconst [roomResult, subsResult] = await Promise.all([\n\t\t\tLivechatRooms.unsetOnHoldByRoomId(roomId),\n\t\t\tSubscriptions.unsetOnHoldByRoomId(roomId),\n\t\t\tMessage.saveSystemMessage<IOmnichannelSystemMessage>('omnichannel_on_hold_chat_resumed', roomId, '', resumeBy, { comment }),\n\t\t]);\n\n\t\tif (roomResult.modifiedCount) {\n\t\t\tvoid notifyOnRoomChangedById(roomId);\n\t\t}","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/local-services/omnichannel.internalService.ts#L89-L125","documentation":"Thrown by resumeRoomOnHold when LivechatInquiry.findOneByRoomId returns no inquiry. A held omnichannel room must have a corresponding inquiry document to resume routing; the service logs 'No inquiry found for room' at error level and aborts.","triggerScenarios":"Resume on a room whose LivechatInquiry record is missing or was deleted — typically a data inconsistency or a room whose inquiry was archived/removed while on hold.","commonSituations":"Inquiry cleanup/migration removed the record; the room was created by an import that did not backfill inquiries; a custom integration deleted inquiries.","solutions":["Confirm a LivechatInquiry exists for the roomId before offering Resume.","If inquiries are missing for held rooms, run a backfill/reconciliation job that recreates them from the room document.","Audit custom integrations that delete or move inquiry documents."],"exampleFix":"// before\nawait omnichannelService.resumeRoomOnHold(room, comment, user);\n\n// after\nconst inquiry = await LivechatInquiry.findOneByRoomId(room._id, {});\nif (!inquiry) {\n  throw new Error('Cannot resume: no inquiry record for this room');\n}\nawait omnichannelService.resumeRoomOnHold(room, comment, user);","handlingStrategy":"validation","validationCode":"const inquiry = await LivechatInquiry.findOneByRoomId(room._id, {});\nif (!inquiry) throw new Error('Cannot resume: no inquiry record for this room');\nawait omnichannelService.resumeRoomOnHold(room, comment, user);","typeGuard":"function isInquiryLike(doc: unknown): doc is ILivechatInquiryRecord {\n  return !!doc && typeof (doc as any)._id === 'string' && typeof (doc as any).rid === 'string';\n}","tryCatchPattern":"try {\n  await omnichannelService.resumeRoomOnHold(room, comment, user);\n} catch (e) {\n  if (e instanceof Error && e.message === 'error-invalid-inquiry') {\n    notifyUser('This room cannot be resumed; the inquiry record is missing.');\n    return;\n  }\n  throw e;\n}","preventionTips":["Confirm a LivechatInquiry exists before offering Resume.","Run reconciliation jobs to backfill missing inquiry records.","Audit integrations that delete inquiry documents."],"tags":["omnichannel","livechat","inquiry","data-integrity"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}