RocketChat/Rocket.Chat · warning · Meteor.Error

error-not-found

error-not-found

Error message

error-not-found

What it means

takeInquiry loads the queued LivechatInquiry by id; if LivechatInquiry.findOneById returns null it throws Meteor.Error('error-not-found', 'Inquiry not found', { method: 'livechat:takeInquiry' }). Inquiries are ephemeral queue entries that are deleted once handled, so this usually means the entry was already consumed or never existed.

Solutions

  1. Refresh the inquiry list from the real-time subscription before retrying the take action
  2. Handle this code as an expected outcome in the queue UI (silently drop the card / show 'already handled')
  3. Verify the inquiryId being sent matches a doc: db.rocketchat_livechat_inquiry.findOne({_id: inquiryId})
  4. Ensure clients subscribe to livechat inquiry stream events so lists stay current

Example fix

// before
await Meteor.callAsync('livechat:takeInquiry', inquiryId);

// after
const inquiry = await LivechatInquiry.findOneById(inquiryId);
if (!inquiry) {
  // stale queue entry — refresh the list instead of erroring
  return refreshQueue();
}
await Meteor.callAsync('livechat:takeInquiry', inquiryId);
Defensive patterns

Strategy: validation

Validate before calling

import { LivechatInquiry } from '@rocket.chat/models';

const inquiry = await LivechatInquiry.findOneById(inquiryId);
if (!inquiry) {
  return { stale: true }; // drop the card; do not call takeInquiry
}
await Meteor.callAsync('livechat:takeInquiry', inquiryId);

Type guard

function isTakeableInquiry(v: { status?: string } | null | undefined): v is { _id: string; status: 'queued' } {
  return !!v && v.status === 'queued';
}

Try / catch

try {
  await Meteor.callAsync('livechat:takeInquiry', inquiryId);
} catch (err) {
  if (err instanceof Meteor.Error && err.error === 'error-not-found') {
    // stale queue entry: refresh the list and remove the card, never retry the same id
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Calling livechat:takeInquiry with an inquiryId from a stale queue listing — another agent took (and the inquiry was removed/retargeted) between rendering the queue and clicking, or the id is simply invalid.

Common situations: Race between multiple agents on a fast-moving queue, stale open tabs showing already-handled inquiries, client retries after a timeout, or UI not subscribing to inquiry change events.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/fe724c6564e4dd48. Report an issue: GitHub.

Appendix: source

Thrown at apps/meteor/server/lib/omnichannel/takeInquiry.ts:18

import { Omnichannel } from '@rocket.chat/core-services';
import { LivechatInquiry, LivechatRooms, Users } from '@rocket.chat/models';
import { Meteor } from 'meteor/meteor';

import { RoutingManager } from './RoutingManager';
import { isAgentAvailableToTakeContactInquiry } from './contacts/isAgentAvailableToTakeContactInquiry';
import { migrateVisitorIfMissingContact } from './contacts/migrateVisitorIfMissingContact';
import { settings } from '../../settings';

export const takeInquiry = async (
	userId: string,
	inquiryId: string,
	options?: { clientAction: boolean; forwardingToDepartment?: { oldDepartmentId: string; transferData: any } },
): Promise<void> => {
	const inquiry = await LivechatInquiry.findOneById(inquiryId);

	if (!inquiry) {
		throw new Meteor.Error('error-not-found', 'Inquiry not found', {
			method: 'livechat:takeInquiry',
		});
	}

	if (inquiry.status === 'taken') {
		throw new Meteor.Error('error-inquiry-taken', 'Inquiry already taken', {
			method: 'livechat:takeInquiry',
		});
	}

	const user = await Users.findOneOnlineAgentById(
		userId,
		settings.get<boolean>('Livechat_enabled_when_agent_idle'),
		settings.get<boolean>('Livechat_accept_chats_with_no_agents'),
		{},
	);
	if (!user) {
		throw new Meteor.Error('error-agent-status-service-offline', 'Agent status is offline or Omnichannel service is not active', {

View on GitHub (pinned to b2c16d5842)