RocketChat/Rocket.Chat · error · Error

The integration does not exists.

Error message

The integration does not exists.

What it means

Thrown by the fetchIntegration helper (apps/meteor/server/api/lib/integrations.ts) that backs integration CRUD endpoints. It calls Integrations.findOneByIdAndCreatedByIfExists({ _id: integrationId, createdBy }) and throws this plain Error when the lookup returns null: either no integration exists with that _id, or one exists but was created by a different user while a createdBy filter was applied. Because it is a plain Error (not a Meteor.Error), the REST layer surfaces it as a generic internal error rather than a typed error code — expect a 500-style response with this message.

Source

Thrown at apps/meteor/server/api/lib/integrations.ts:34

	return false;
};

export const findOneIntegration = async ({
	userId,
	integrationId,
	createdBy,
}: {
	userId: string;
	integrationId: string;
	createdBy?: IUser['_id'];
}): Promise<IIntegration> => {
	const integration = await Integrations.findOneByIdAndCreatedByIfExists({
		_id: integrationId,
		createdBy,
	});
	if (!integration) {
		throw new Error('The integration does not exists.');
	}
	if (!(await hasIntegrationsPermission(userId, integration))) {
		throw new Error('not-authorized');
	}
	return integration;
};

View on GitHub (pinned to b2c16d5842)

Solutions

  1. List live integrations with GET /api/v1/integrations.list and copy the exact, current _id
  2. Confirm the integration was created by the same user implied by the request (or omit/adjust the createdBy expectation)
  3. Re-create the integration if it was deleted and update your stored reference

Example fix

// before
POST /api/v1/integrations.remove { "integrationId": "old-stale-id", "userId": "..." }

// after
GET  /api/v1/integrations.list?userId=...   // grab current _id
POST /api/v1/integrations.remove { "integrationId": "nS8MLKhGdQv4vEBRi", "userId": "..." }
Defensive patterns

Strategy: validation

Validate before calling

async function loadIntegrationId(client, nameOrId: string): Promise<string> {
  const { data } = await client.get('/api/v1/integrations.list');
  const all = [...data.integrations, ...data.incomingIntegrations ?? []];
  const hit = all.find((i) => i._id === nameOrId || i.name === nameOrId);
  if (!hit) throw new Error(`integration ${nameOrId} not found; re-check integrations.list`);
  return hit._id;
}

Try / catch

try {
  await client.post('/api/v1/integrations.remove', { integrationId, userId });
} catch (e: any) {
  if (/does not exists/i.test(e?.response?.data?.error ?? '')) {
    throw new NotFoundError(`integration ${integrationId} gone — refresh from integrations.list`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling integrations.update / integrations.remove / similar v1 endpoints with an integrationId that is deleted, truncated, or belongs to another user. Copying an integration _id from a different workspace also reproduces it.

Common situations: Stale integration ID stored in a script or CI job after someone re-created the integration; multi-admin workspace where the integration's creator field doesn't match the queried createdBy; ID copied with whitespace or missing characters.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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