{"record":{"id":"88abcc94f4362438","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-inquiry-88abcc","errorCode":"error-invalid-inquiry","errorMessage":"error-invalid-inquiry","messagePattern":"error-invalid-inquiry","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/omnichannel/Helper.ts","lineNumber":520,"sourceCode":"\t\tsettings.get<boolean>('Livechat_accept_chats_with_no_agents'),\n\t\t{},\n\t);\n\tif (!user) {\n\t\tlogger.debug({\n\t\t\tmsg: 'Agent is offline. Cannot forward',\n\t\t\tagentId,\n\t\t});\n\t\tthrow new Error('error-user-is-offline');\n\t}\n\n\tconst { _id: rid, servedBy: oldServedBy } = room;\n\tconst inquiry = await LivechatInquiry.findOneByRoomId(rid, {});\n\tif (!inquiry) {\n\t\tlogger.debug({\n\t\t\tmsg: 'No inquiries found for room. Cannot forward',\n\t\t\troomId: room._id,\n\t\t});\n\t\tthrow new Error('error-invalid-inquiry');\n\t}\n\n\tif (oldServedBy && agentId === oldServedBy._id) {\n\t\tthrow new Error('error-selected-agent-room-agent-are-same');\n\t}\n\n\tconst { username } = user;\n\tconst agent = { agentId, username };\n\t// Remove department from inquiry to make sure the routing algorithm treat this as forwarding to agent and not as forwarding to department\n\tdelete inquiry.department;\n\t// There are some Enterprise features that may interrupt the forwarding process\n\t// Due to that we need to check whether the agent has been changed or not\n\tlogger.debug({\n\t\tmsg: 'Forwarding inquiry to agent',\n\t\tinquiryId: inquiry._id,\n\t\tagentId: agent.agentId,\n\t});\n\tconst roomTaken = await RoutingManager.takeInquiry(","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/omnichannel/Helper.ts#L502-L538","documentation":"Forwarding a livechat room to an agent requires an open inquiry for that room (LivechatInquiry.findOneByRoomId); if none exists the forward aborts with error-invalid-inquiry. Inquiries exist only while a chat is queued or being served - closed rooms and rooms whose inquiry was already consumed by another transfer have none.","triggerScenarios":"Forwarding a room whose inquiry was already dequeued by a concurrent transfer; forward attempted on a chat the customer closed; stale room list in the agent UI.","commonSituations":"Double-click or duplicate forward requests racing each other; chat closed while the transfer dialog was open; automation retrying an already-completed transfer.","solutions":["Refresh the room/inquiry state and retry once if the room is still open","Guard the transfer UI against duplicate submissions (disable the button while pending)","If the chat legitimately has no inquiry, place it back in the queue instead of forwarding"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const inquiry = await LivechatInquiry.findOneByRoomId(rid, { projection: { _id: 1 } });\nif (!inquiry) {\n  // no inquiry: re-queue the room instead of forwarding\n  throw new Error('error-invalid-inquiry');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await forwardRoomToAgent(room, transferData, guest);\n} catch (err) {\n  if (err instanceof Error && err.message === 'error-invalid-inquiry') {\n    // refresh room state; retry only if still open and un-transferred\n  } else throw err;\n}","preventionTips":["Disable the transfer button while a request is in flight to avoid duplicate transfers","Refresh room state before retrying a failed forward"],"tags":["omnichannel","livechat","inquiry","transfer","rocket-chat"],"backgroundTag":"entity-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}