{"record":{"id":"e42c4e0f655607ea","repo":"RocketChat/Rocket.Chat","slug":"invalid-response-from-the-marketplace","errorCode":null,"errorMessage":"Invalid response from the Marketplace","messagePattern":"Invalid response from the Marketplace","errorType":"exception","errorClass":null,"httpStatus":400,"severity":"error","filePath":"apps/meteor/ee/server/apps/communication/rest.ts","lineNumber":337,"sourceCode":"\t\t\t\t\t\t\t\t\t\tignoreSsrfValidation: true,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t.catch((cause) => {\n\t\t\t\t\t\t\t\t\t\tthrow new Error('App metadata download failed', { cause });\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t\tif (downloadResponse.headers.get('content-type') !== 'application/zip') {\n\t\t\t\t\t\t\t\tthrow new Error('Invalid url. It doesn\\'t exist or is not \"application/zip\".');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbuff = Buffer.from(await downloadResponse.arrayBuffer());\n\t\t\t\t\t\t\tmarketplaceInfo = await marketplaceResponse.json();\n\n\t\t\t\t\t\t\t// Note: marketplace responds with an array of the marketplace info on the app, but it is expected\n\t\t\t\t\t\t\t// to always have one element since we are fetching a specific app version.\n\t\t\t\t\t\t\tif (!Array.isArray(marketplaceInfo) || marketplaceInfo?.length !== 1) {\n\t\t\t\t\t\t\t\torchestrator.getRocketChatLogger().error({ msg: 'Error getting app information from marketplace', marketplaceInfo });\n\t\t\t\t\t\t\t\tthrow new Error('Invalid response from the Marketplace');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpermissionsGranted = this.bodyParams.permissionsGranted;\n\t\t\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\t\t\tlet message;\n\n\t\t\t\t\t\t\tif (err instanceof Error) {\n\t\t\t\t\t\t\t\torchestrator.getRocketChatLogger().error({ msg: 'Error installing app from marketplace:', err });\n\t\t\t\t\t\t\t\tmessage = err.message;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmessage = err;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn API.v1.failure({ error: message });\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst app = await getUploadFormData(\n\t\t\t\t\t\t\t{","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/apps/communication/rest.ts#L319-L355","documentation":"Thrown when the marketplace metadata response for a specific app version is valid JSON but not the expected shape: an array with exactly one element. The cloud v1/apps/:appId?appVersion=:version endpoint is documented (per the code comment) to return a one-element array of marketplace info; anything else means the marketplace answered with an error envelope or a different payload, which is logged ('Error getting app information from marketplace') before throwing.","triggerScenarios":"POST marketplace-install where marketplaceResponse.json() yields an object (e.g. { error: ... }), an empty array, or multiple entries — typically because the requested appVersion was not found and the cloud returned its error object, or an API contract change. The zip content-type check (164) has already passed when this fires.","commonSituations":"Installing an old/unpublished/pulled app version so the cloud responds with an error object instead of a one-item array; cloud API schema drift after a cloud-side update; requesting a version while the marketplace index is mid-replication returning zero entries.","solutions":["Check the server log entry 'Error getting app information from marketplace' — it dumps marketplaceInfo, showing exactly what the cloud returned.","Retry with a known-good published version of the app (list versions via GET v1/apps/:appId).","If every app fails, the cloud contract or the workspace registration is off: re-sync the workspace (Administration -> Connectivity Services) and upgrade Rocket.Chat to the latest patch so client and cloud API versions match.","Report to Rocket.Chat support if the dumped payload shows a cloud-side error for a version that clearly exists."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await installFromMarketplace(appId, version);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Invalid response from the Marketplace') {\n    // check server log for the dumped marketplaceInfo payload; retry with a confirmed version\n  }\n}","preventionTips":["Prefer latest published versions over hardcoded old version strings.","Keep server and cloud API generations in sync by staying on supported releases.","Log and report the marketplace payload whenever this fires — the shape tells you if it is a version issue or a cloud incident."],"tags":["marketplace","app-install","response-validation","cloud","enterprise"],"backgroundTag":"invalid-upstream-response","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}