RocketChat/Rocket.Chat · error · CloudWorkspaceConnectionError
Invalid response from Rocket.Chat Cloud
Error message
Invalid response from Rocket.Chat Cloud
What it means
The legacy sync validates the cloud's response with a zod schema (Cloud.WorkspaceSyncPayloadSchema.safeParse). A 200 response whose body does not match the expected shape throws CloudWorkspaceConnectionError('Invalid response from Rocket.Chat Cloud') with a prettified zod error as cause — i.e. version skew: this server's schema no longer matches what the cloud returns.
Source
Thrown at apps/meteor/server/lib/cloud/syncWorkspace/legacySyncWorkspace.ts:55
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;
}
const result = Cloud.WorkspaceSyncPayloadSchema.safeParse(payload);
if (!result.success) {
throw new CloudWorkspaceConnectionError('Invalid response from Rocket.Chat Cloud', {
cause: z.prettifyError(result.error),
});
}
return result.data;
};
/** @deprecated */
const consumeWorkspaceSyncPayload = async (result: Cloud.WorkspaceSyncPayload) => {
if (result.publicKey) {
(await Settings.updateValueById('Cloud_Workspace_PublicKey', result.publicKey)).modifiedCount &&
void notifyOnSettingChangedById('Cloud_Workspace_PublicKey');
}
if (result.trial?.trialID) {
(await Settings.updateValueById('Cloud_Workspace_Had_Trial', true)).modifiedCount &&
void notifyOnSettingChangedById('Cloud_Workspace_Had_Trial');
}View on GitHub (pinned to b2c16d5842)
Solutions
- Update the Rocket.Chat server to the latest release so its payload schema matches the current cloud API.
- Inspect the logged zod cause to see exactly which field failed validation.
- Check for proxies that rewrite or truncate response bodies.
- If you are already on a current version, report the issue to Rocket.Chat support including the zod cause.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const data = await fetchWorkspaceClientPayload({ token, workspaceRegistrationData });
} catch (e) {
if (e instanceof CloudWorkspaceConnectionError && e.message === 'Invalid response from Rocket.Chat Cloud') {
// zod cause in e.cause names the mismatched field: usually version skew — update the server
}
throw e;
} Prevention
- Keep server versions current so WorkspaceSyncPayloadSchema tracks the cloud API.
- Always log the zod 'cause' when this fires — it pinpoints the exact offending field.
- Report schema mismatches on current versions to Rocket.Chat with the prettified zod error attached.
When it happens
Trigger: legacySyncWorkspace receives a payload with new, renamed, or re-typed fields (e.g. publicKey, trial flags, flags object) that the server's older zod schema rejects, or a proxy mangled the JSON body.
Common situations: Old Rocket.Chat server against an updated cloud API; response bodies truncated or rewritten by intermediaries; rare cloud-side regressions emitting unexpected payloads.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- failed type validation
- Failed to connect to Rocket.Chat Cloud: ${error}
- Failed to connect to Rocket.Chat Cloud: ${response.statusTex
- Workspace access token is empty
- error-param-required
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/f59aab4575939fa5.
Report an issue: GitHub.