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

  1. Update the Rocket.Chat server to the latest release so its payload schema matches the current cloud API.
  2. Inspect the logged zod cause to see exactly which field failed validation.
  3. Check for proxies that rewrite or truncate response bodies.
  4. 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

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


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/f59aab4575939fa5. Report an issue: GitHub.