{"record":{"id":"ffa784e29a45983f","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-room-ffa784","errorCode":"error-invalid-room","errorMessage":"Invalid room","messagePattern":"Invalid room","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts","lineNumber":130,"sourceCode":"\t\tconst channelType = channel[0];\n\t\tchannel = channel.slice(1);\n\t\tlet record;\n\n\t\tswitch (channelType) {\n\t\t\tcase '#':\n\t\t\t\trecord = await Rooms.findOne({\n\t\t\t\t\t$or: [{ _id: channel }, { name: channel }],\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\tcase '@':\n\t\t\t\trecord = await Users.findOne({\n\t\t\t\t\t$or: [{ _id: channel }, { username: channel }],\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (!record) {\n\t\t\tthrow new Meteor.Error('error-invalid-room', 'Invalid room', {\n\t\t\t\tmethod: 'updateIncomingIntegration',\n\t\t\t});\n\t\t}\n\n\t\tif (\n\t\t\t!(await hasAllPermissionAsync(userId, ['manage-incoming-integrations', 'manage-own-incoming-integrations'])) &&\n\t\t\t!(await Subscriptions.findOneByRoomIdAndUserId(record._id, userId, { projection: { _id: 1 } }))\n\t\t) {\n\t\t\tthrow new Meteor.Error('error-invalid-channel', 'Invalid Channel', {\n\t\t\t\tmethod: 'updateIncomingIntegration',\n\t\t\t});\n\t\t}\n\t}\n\n\tconst username = 'username' in integration ? integration.username : currentIntegration.username;\n\tconst user = await Users.findOneByUsername(username, { projection: { _id: 1, username: 1 } });\n\n\tif (!user) {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/integrations/incoming/updateIncomingIntegration.ts#L112-L148","documentation":"Thrown by updateIncomingIntegration while resolving each channel target: after stripping the leading '#'/'@', '#x' must match a Room by _id or name and '@x' a User by _id or username. A miss means the referenced room or user does not exist on this server. Note the update payload replaces the whole channel list, so one dead target blocks the entire update.","triggerScenarios":"Updating with '#renamed-room' after the room was renamed; '#archived-channel' that was deleted; '@departed.user' whose account was removed; a typo such as '#dev-ops' vs '#devops'.","commonSituations":"Long-lived integrations whose channel lists go stale as rooms are reorganized; bulk edit tooling applying one channel set to many workspaces where not every room exists; copy-paste between environments.","solutions":["Use exact current room names (lowercase slug, no '#') and existing @usernames in every segment","Remove or recreate dead targets before submitting the update","Pre-verify each target: GET /api/v1/channels.info?roomName=... or Rooms.findOne({ name }) server-side"],"exampleFix":"// before\nawait Meteor.callAsync('updateIncomingIntegration', id, { ...payload, channel: '#renamed-room,@gone.user' });\n// after: only existing targets\nawait Meteor.callAsync('updateIncomingIntegration', id, { ...payload, channel: '#new-room-name' });","handlingStrategy":"validation","validationCode":"// server-side caller: resolve every target before the update\nimport { Rooms, Users } from '@rocket.chat/models';\nfor (const entry of channelList.split(',')) {\n  const type = entry.trim()[0]; const name = entry.trim().slice(1);\n  const exists = type === '#' ? !!(await Rooms.findOne({ $or: [{ _id: name }, { name }] })) : !!(await Users.findOne({ $or: [{ _id: name }, { username: name }] }));\n  if (!exists) throw new Error(`target no longer exists: ${entry.trim()}`);\n}\nawait Meteor.callAsync('updateIncomingIntegration', integrationId, { ...integration, channel: channelList });","typeGuard":null,"tryCatchPattern":"try {\n  await Meteor.callAsync('updateIncomingIntegration', integrationId, integration);\n} catch (err) {\n  if (err instanceof Meteor.Error && err.error === 'error-invalid-room') { /* drop dead targets from the list, notify user */ }\n}","preventionTips":["Re-validate stored channel lists whenever rooms are renamed or archived","Use room pickers over free text","Add a health-check job that flags integrations referencing missing rooms"],"tags":["rocket-chat","incoming-integration","room-not-found","channel-validation","meteor-method"],"backgroundTag":"room-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}