RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-targetRoom
error-invalid-targetRoom
Error message
Invalid Target Room
What it means
Thrown by _verifyRequiredFields when the chosen event uses a target room but the integration payload omits `targetRoom`. Only the userCreated event declares use.targetRoom = true, because new-user notifications must be posted somewhere other than the channel list, so a userCreated integration without targetRoom is rejected with Meteor.Error code 'error-invalid-targetRoom'.
Source
Thrown at apps/meteor/server/lib/integrations/lib/validateOutgoingIntegration.ts:34
if (
!integration.event ||
!Match.test(integration.event, String) ||
integration.event.trim() === '' ||
!outgoingEvents[integration.event]
) {
throw new Meteor.Error('error-invalid-event-type', 'Invalid event type', {
function: 'validateOutgoing._verifyRequiredFields',
});
}
if (!integration.username || !Match.test(integration.username, String) || integration.username.trim() === '') {
throw new Meteor.Error('error-invalid-username', 'Invalid username', {
function: 'validateOutgoing._verifyRequiredFields',
});
}
if (outgoingEvents[integration.event].use.targetRoom && !integration.targetRoom) {
throw new Meteor.Error('error-invalid-targetRoom', 'Invalid Target Room', {
function: 'validateOutgoing._verifyRequiredFields',
});
}
if (!Match.test(integration.urls, [String])) {
throw new Meteor.Error('error-invalid-urls', 'Invalid URLs', {
function: 'validateOutgoing._verifyRequiredFields',
});
}
integration.urls = integration.urls.filter((url) => url && url.trim() !== '');
if (integration.urls.length === 0) {
throw new Meteor.Error('error-invalid-urls', 'Invalid URLs', {
function: 'validateOutgoing._verifyRequiredFields',
});
}
}View on GitHub (pinned to b2c16d5842)
Solutions
- Add targetRoom with the destination room name for userCreated integrations, e.g. targetRoom: 'announcements'
- Verify the room exists before saving so you do not just move the failure to delivery time
- Remember the rule: only userCreated needs targetRoom; the other six events do not
Example fix
// before
{ type: 'webhook-outgoing', event: 'userCreated', username: 'rocket.cat', urls: [...] }
// after
{ type: 'webhook-outgoing', event: 'userCreated', username: 'rocket.cat', targetRoom: 'announcements', urls: [...] } Defensive patterns
Strategy: validation
Validate before calling
const eventsNeedingTargetRoom = ['userCreated'];
if (eventsNeedingTargetRoom.includes(event) && !integration.targetRoom?.trim()) {
throw new TypeError('userCreated integrations require a targetRoom');
} Prevention
- Show the targetRoom field in your form only for userCreated and mark it required there
- Verify the target room exists before saving the integration
When it happens
Trigger: POST /api/v1/integrations.create with type 'webhook-outgoing' and event 'userCreated' while targetRoom is absent, empty, or undefined in the payload.
Common situations: Teams wiring HR/onboarding bots to the userCreated event and forgetting the destination room; payloads copied from a sendMessage integration where targetRoom is not a field.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- history-data-must-be-defined
- error-invalid-event-type
- error-invalid-username
- error-invalid-urls
- error-invalid-channel-start-with-chars
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/10f7deff108be473.
Report an issue: GitHub.