RocketChat/Rocket.Chat · error · Error
Invalid response from the Marketplace
Error message
Invalid response from the Marketplace
What it means
Thrown after the marketplace metadata fetch succeeds but the parsed JSON is not a single-element array. The marketplace is expected to return exactly one element (info for the requested app version); any other shape (empty array, multi-element array, or a non-array object) is treated as an invalid marketplace response. The response is logged via orchestrator.getRocketChatLogger().error before throwing.
Source
Thrown at apps/meteor/ee/server/apps/communication/rest.ts:337
ignoreSsrfValidation: true,
})
.catch((cause) => {
throw new Error('App metadata download failed', { cause });
}),
]);
if (downloadResponse.headers.get('content-type') !== 'application/zip') {
throw new Error('Invalid url. It doesn\'t exist or is not "application/zip".');
}
buff = Buffer.from(await downloadResponse.arrayBuffer());
marketplaceInfo = await marketplaceResponse.json();
// Note: marketplace responds with an array of the marketplace info on the app, but it is expected
// to always have one element since we are fetching a specific app version.
if (!Array.isArray(marketplaceInfo) || marketplaceInfo?.length !== 1) {
orchestrator.getRocketChatLogger().error({ msg: 'Error getting app information from marketplace', marketplaceInfo });
throw new Error('Invalid response from the Marketplace');
}
permissionsGranted = this.bodyParams.permissionsGranted;
} catch (err: unknown) {
let message;
if (err instanceof Error) {
orchestrator.getRocketChatLogger().error({ msg: 'Error installing app from marketplace:', err });
message = err.message;
} else {
message = err;
}
return API.v1.failure({ error: message });
}
} else {
const app = await getUploadFormData(
{View on GitHub (pinned to f9d3ec372b)
Solutions
- Verify the appId and version still exist on the marketplace (browse the marketplace page).
- Re-fetch the app listing to get a current, valid version number and retry the install.
- Check server logs for the marketplaceInfo payload that triggered the throw (it is logged at error level).
- If the marketplace API contract changed, update Rocket.Chat to a version compatible with the current marketplace.
Defensive patterns
Strategy: type-guard
Validate before calling
function isSingleMarketplaceInfo(payload: unknown): payload is IMarketplaceInfo[] {
return Array.isArray(payload) && payload.length === 1;
}
const info = await marketplaceResponse.json();
if (!isSingleMarketplaceInfo(info)) {
throw new Error('Marketplace returned unexpected metadata shape');
} Type guard
const isSingleElementArray = <T>(value: unknown): value is [T] => Array.isArray(value) && value.length === 1;
Try / catch
try {
await installMarketplaceApp(appId, version);
} catch (e) {
if (e instanceof Error && e.message === 'Invalid response from the Marketplace') {
// refresh app listing; the version may have been unpublished
await refreshAppListing();
retryWithCurrentVersion();
}
} Prevention
- Re-fetch the marketplace listing immediately before install to confirm the version still exists.
- Treat an empty/multi metadata array as a stale-cache signal and refresh.
- Log the full marketplaceInfo payload when this fires to diagnose contract drift.
When it happens
Trigger: POST /api/v1/apps marketplace install where the v1/apps/{appId}?appVersion={version} endpoint returns an unexpected payload: an empty array (app/version gone), an object with an error field rather than the array, or multiple matches.
Common situations: The requested app version was deleted/unpublished between the listing call and the install call; marketplace API version drift where the contract changed; appId casing or slug mismatch causing the metadata endpoint to return a different shape.
Related errors
- App package download failed
- App metadata download failed
- Invalid url. It doesn't exist or is not "application/zip".
- Invalid response from API
- App not found
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/e42c4e0f655607ea.
Report an issue: GitHub.