RocketChat/Rocket.Chat · error · CloudWorkspaceConnectionError
Failed to connect to Rocket.Chat Cloud: ${error}
Error message
Failed to connect to Rocket.Chat Cloud: ${error} What it means
fetchRegistrationDataPayload POSTs the workspace registration request to the Rocket.Chat Cloud register endpoint with the registration token as Bearer. When the cloud answers non-ok with a JSON body, this CloudWorkspaceConnectionError wraps the cloud's own error string — the text after the colon is the cloud's rejection reason, not a local one.
Source
Thrown at apps/meteor/server/lib/cloud/connectWorkspace.ts:35
client_name: string;
redirect_uris: string[];
};
}) => {
const cloudUrl = settings.get<string>('Cloud_Url');
const response = await fetch(`${cloudUrl}/api/oauth/clients`, {
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
},
body,
// SECURITY: the URL is a default hardcoded value or an envvar/setting set by an admin. It's safe to disable this check.
ignoreSsrfValidation: true,
});
if (!response.ok) {
try {
const { error } = await response.json();
throw new CloudWorkspaceConnectionError(`Failed to connect to Rocket.Chat Cloud: ${error}`);
} catch (error) {
throw new CloudWorkspaceConnectionError(`Failed to connect to Rocket.Chat Cloud: ${response.statusText}`);
}
}
const payload = await response.json();
if (!payload) {
return undefined;
}
return payload;
};
export async function connectWorkspace(token: string) {
assertNotOfflineLicense();
if (!token) {View on GitHub (pinned to b2c16d5842)
Solutions
- Read the error text after the colon — it states the cloud's exact rejection reason and usually names the field at fault.
- Generate a fresh registration token in the Rocket.Chat Cloud console and retry with it.
- Verify Organization_Email and Site_Name settings contain valid values.
- Confirm Cloud_Url points to the right cloud environment (default https://cloud.rocket.chat).
Defensive patterns
Strategy: try-catch
Validate before calling
const token = tokenInput.trim();
if (!token) throw new Error('registration token is required'); Try / catch
import { CloudWorkspaceConnectionError } from '<cloud errors module>';
try {
await Meteor.callAsync('cloud:connectWorkspace', token);
} catch (e) {
if (e instanceof CloudWorkspaceConnectionError) {
// the message after the colon is the cloud's own reason — surface it to the admin
}
throw e;
} Prevention
- Generate a fresh registration token per attempt; treat tokens as single-use.
- Validate Organization_Email / Site_Name before starting cloud registration.
- Keep Cloud_Url on the default unless you deliberately target another cloud environment.
When it happens
Trigger: connectWorkspace(token) — the cloud registration flow ('cloud:connectWorkspace' method, Setup Wizard or Admin > Cloud) — where the cloud rejects the request: expired or already-consumed registration token, invalid Organization_Email, or the workspace is already registered.
Common situations: Reusing a registration token after a previous attempt consumed it; a token pasted with whitespace or truncated; Organization_Email empty or malformed; cloud portal state out of sync with the workspace.
Related errors
- Invalid registration token
- (await response.json()).error
- Failed to fetch registration intent endpoint
- Failed to connect to Rocket.Chat Cloud: ${response.statusTex
- error-invalid-state
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/dddc6d3e24bd7327.
Report an issue: GitHub.