{"record":{"id":"54d1a8c1c89d8df0","repo":"RocketChat/Rocket.Chat","slug":"the-integration-does-not-exists","errorCode":null,"errorMessage":"The integration does not exists.","messagePattern":"The integration does not exists\\.","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/lib/integrations.ts","lineNumber":34,"sourceCode":"\n\treturn false;\n};\n\nexport const findOneIntegration = async ({\n\tuserId,\n\tintegrationId,\n\tcreatedBy,\n}: {\n\tuserId: string;\n\tintegrationId: string;\n\tcreatedBy?: IUser['_id'];\n}): Promise<IIntegration> => {\n\tconst integration = await Integrations.findOneByIdAndCreatedByIfExists({\n\t\t_id: integrationId,\n\t\tcreatedBy,\n\t});\n\tif (!integration) {\n\t\tthrow new Error('The integration does not exists.');\n\t}\n\tif (!(await hasIntegrationsPermission(userId, integration))) {\n\t\tthrow new Error('not-authorized');\n\t}\n\treturn integration;\n};\n","sourceCodeStart":16,"sourceCodeEnd":41,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/api/lib/integrations.ts#L16-L41","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List live integrations with GET /api/v1/integrations.list and copy the exact, current _id","Confirm the integration was created by the same user implied by the request (or omit/adjust the createdBy expectation)","Re-create the integration if it was deleted and update your stored reference"],"exampleFix":"// before\nPOST /api/v1/integrations.remove { \"integrationId\": \"old-stale-id\", \"userId\": \"...\" }\n\n// after\nGET  /api/v1/integrations.list?userId=...   // grab current _id\nPOST /api/v1/integrations.remove { \"integrationId\": \"nS8MLKhGdQv4vEBRi\", \"userId\": \"...\" }","handlingStrategy":"validation","validationCode":"async function loadIntegrationId(client, nameOrId: string): Promise<string> {\n  const { data } = await client.get('/api/v1/integrations.list');\n  const all = [...data.integrations, ...data.incomingIntegrations ?? []];\n  const hit = all.find((i) => i._id === nameOrId || i.name === nameOrId);\n  if (!hit) throw new Error(`integration ${nameOrId} not found; re-check integrations.list`);\n  return hit._id;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await client.post('/api/v1/integrations.remove', { integrationId, userId });\n} catch (e: any) {\n  if (/does not exists/i.test(e?.response?.data?.error ?? '')) {\n    throw new NotFoundError(`integration ${integrationId} gone — refresh from integrations.list`);\n  }\n  throw e;\n}","preventionTips":["Resolve integration IDs from integrations.list at job start instead of hardcoding","Store the integration name too, so IDs can be re-resolved after re-creation","Remember this is a plain Error — match on message text, there is no error code"],"tags":["rest-api","integrations","not-found","plain-error"],"backgroundTag":"resource-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}