RocketChat/Rocket.Chat · error · CloudWorkspaceConnectionError

failed type validation

Error message

failed type validation

What it means

Cloud answered the sync request with HTTP 200, but the JSON body failed Cloud.WorkspaceSyncResponseSchema.safeParse (zod): the returned shape does not match what this server build expects for fields like license, removeLicense, or cloudSyncAnnouncement. The error's cause contains z.prettifyError output pinpointing the failing fields.

Source

Thrown at apps/meteor/server/lib/cloud/syncWorkspace/fetchWorkspaceSyncPayload.ts:36

		headers: {
			Authorization: `Bearer ${token}`,
		},
		body: data,
		// 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) {
		const { error } = await response.json();
		throw new CloudWorkspaceConnectionError(`Failed to connect to Rocket.Chat Cloud: ${error}`);
	}

	const payload = await response.json();

	const result = Cloud.WorkspaceSyncResponseSchema.safeParse(payload);

	if (!result.success) {
		throw new CloudWorkspaceConnectionError('failed type validation', {
			cause: z.prettifyError(result.error),
		});
	}

	return result.data;
}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Update the Rocket.Chat server to a current release so WorkspaceSyncResponseSchema matches Cloud's payload
  2. Inspect err.cause (the zod prettified report) to see exactly which field mismatched, and report it if both sides are on current versions
  3. Remove or verify any HTTPS proxy in front of the server that could alter response bodies
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const payload = await fetchWorkspaceSyncPayload({ token, data });
} catch (err) {
  if (err instanceof CloudWorkspaceConnectionError && err.message === 'failed type validation') {
    // payload/schema skew: log err.cause (zod report), keep last known good state, don't crash the job
    logger.warn({ msg: 'Cloud sync schema mismatch', cause: err.cause });
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Cloud ships a response whose fields are renamed, missing, or differently typed relative to the local zod schema — typically a server build older (or newer) than the Cloud API — or an intermediary returns a different JSON document with a 200 status.

Common situations: Downgraded or fork-pinned server versions lagging the Cloud API; a proxy or captive portal injecting a JSON body; Cloud mid-deployment emitting a transitional payload.

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/35a65b5def7ee1f9. Report an issue: GitHub.