#38669·mattermost

[Bug]: Connected Workspaces shared-channel member sync fails when RestrictCreationToDomains is enabled

Author: F1ourishCreated Sep 21, 2026Updated Sep 23, 2026
LabelsBug Report/Open

Before you file a bug report

Mattermost Server Version

11.10.1

Operating System

Ubuntu 24.04 LTS

Steps to reproduce

  1. Connect two Mattermost instances using Connected Workspaces.
  2. Enable TeamSettings.RestrictCreationToDomains on the receiving workspace and include the remote user's actual email domain in the allowed list.
  3. Share a channel between the workspaces.
  4. Add a remote user whose real email belongs to the allowed remote domain.
  5. Trigger shared-channel member synchronization.
  6. Observe that the Remote Cluster remains healthy, but the remote user is not added to the local team/shared channel.
  7. Check the receiving workspace logs and observe a JoinUserToTeam failure caused by domain validation.
  8. Inspect the remote user on the receiving workspace and note that users.email contains a generated synthetic value while the actual email is stored in props.RemoteEmail.

Expected behavior

A Connected Workspaces remote user whose real email belongs to a domain listed in TeamSettings.RestrictCreationToDomains should be successfully added to the local team and shared channel.

The synthetic local representation of the remote user's email should not cause domain validation to fail.

Observed behavior

Shared-channel member synchronization fails during the local team membership step.

The remote user's actual email is preserved in props.RemoteEmail, while users.email contains a generated synthetic value without an email domain.

The team domain validation appears to be performed against users.email, causing the remote user to fail the domain check even though props.RemoteEmail belongs to a domain explicitly allowed by TeamSettings.RestrictCreationToDomains.

As a result, the remote user exists on the receiving workspace, but no corresponding team/channel membership is created.

Log Output

bash
Error upserting sync user
caller="sharedchannel/sync_recv.go:145"
remote=<remote>
channel_id=<channel_id>
user_id=<user_id>
error="error adding sync user to Team: JoinUserToTeam: the user cannot be added as the domain associated with the account is not permitted"

Failed to process membership change
caller="sharedchannel/membership_recv.go:79"
user_id=<user_id>
channel_id=<channel_id>
remote_id=<remote_cluster_id>
is_add=true
error="cannot upsert user for channel add: error adding sync user to Team: JoinUserToTeam: the user cannot be added as the domain associated with the account is not permitted"

Some membership changes failed
caller="sharedchannel/membership_recv.go:92"

Additional Information

The team itself has no team-specific domain restriction: teams.alloweddomains = ''.

MM_FEATUREFLAGS_ENABLESHAREDCHANNELSDMS=true MM_FEATUREFLAGS_ENABLESYNCALLUSERSFORREMOTECLUSTER=true MM_FEATUREFLAGS_ENABLESHAREDCHANNELSMEMBERSYNC=true This parameters is enabled on both workspaces.

The remote user's actual domain is explicitly included in TeamSettings.RestrictCreationToDomains.

On the source workspace, the user has a normal email such as [email protected]. On the receiving workspace, the same remote user is represented approximately as:

users.email = <generated synthetic ID> props.RemoteEmail = [email protected]

The Remote Cluster connection itself is healthy. The failure occurs specifically while adding the synchronized remote user to the receiving workspace team.

A possible fix would be to use props.RemoteEmail for domain-policy validation when the user is a Connected Workspaces remote user, while continuing to keep the synthetic value in users.email.

This seems preferable to bypassing RestrictCreationToDomains entirely, because the configured domain policy would still be enforced.