{"record":{"id":"f59aab4575939fa5","repo":"RocketChat/Rocket.Chat","slug":"invalid-response-from-rocket-chat-cloud","errorCode":null,"errorMessage":"Invalid response from Rocket.Chat Cloud","messagePattern":"Invalid response from Rocket\\.Chat Cloud","errorType":"exception","errorClass":"CloudWorkspaceConnectionError","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/cloud/syncWorkspace/legacySyncWorkspace.ts","lineNumber":55,"sourceCode":"\tif (!response.ok) {\n\t\ttry {\n\t\t\tconst { error } = await response.json();\n\t\t\tthrow new CloudWorkspaceConnectionError(`Failed to connect to Rocket.Chat Cloud: ${error}`);\n\t\t} catch (error) {\n\t\t\tthrow new CloudWorkspaceConnectionError(`Failed to connect to Rocket.Chat Cloud: ${response.statusText}`);\n\t\t}\n\t}\n\n\tconst payload = await response.json();\n\n\tif (!payload) {\n\t\treturn undefined;\n\t}\n\n\tconst result = Cloud.WorkspaceSyncPayloadSchema.safeParse(payload);\n\n\tif (!result.success) {\n\t\tthrow new CloudWorkspaceConnectionError('Invalid response from Rocket.Chat Cloud', {\n\t\t\tcause: z.prettifyError(result.error),\n\t\t});\n\t}\n\n\treturn result.data;\n};\n\n/** @deprecated */\nconst consumeWorkspaceSyncPayload = async (result: Cloud.WorkspaceSyncPayload) => {\n\tif (result.publicKey) {\n\t\t(await Settings.updateValueById('Cloud_Workspace_PublicKey', result.publicKey)).modifiedCount &&\n\t\t\tvoid notifyOnSettingChangedById('Cloud_Workspace_PublicKey');\n\t}\n\n\tif (result.trial?.trialID) {\n\t\t(await Settings.updateValueById('Cloud_Workspace_Had_Trial', true)).modifiedCount &&\n\t\t\tvoid notifyOnSettingChangedById('Cloud_Workspace_Had_Trial');\n\t}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/cloud/syncWorkspace/legacySyncWorkspace.ts#L37-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"Old Rocket.Chat server against an updated cloud API; response bodies truncated or rewritten by intermediaries; rare cloud-side regressions emitting unexpected payloads.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const data = await fetchWorkspaceClientPayload({ token, workspaceRegistrationData });\n} catch (e) {\n  if (e instanceof CloudWorkspaceConnectionError && e.message === 'Invalid response from Rocket.Chat Cloud') {\n    // zod cause in e.cause names the mismatched field: usually version skew — update the server\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["rocket-chat","cloud","zod","schema-validation","sync"],"backgroundTag":"schema-validation-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}