{"record":{"id":"88371c9f5833a7ed","repo":"RocketChat/Rocket.Chat","slug":"marketplace-failed-to-fetch-apps","errorCode":null,"errorMessage":"Marketplace_Failed_To_Fetch_Apps","messagePattern":"Marketplace_Failed_To_Fetch_Apps","errorType":"error_code","errorClass":"MarketplaceAppsError","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts","lineNumber":195,"sourceCode":"\n\tApps.getRocketChatLogger().error({ msg: 'Error fetching marketplace apps', status: request.status, response });\n\n\t// TODO: Refactor cloud to return a proper error code on unsupported version\n\tif (request.status === 426 && 'errorMsg' in response && response.errorMsg === 'unsupported version') {\n\t\tthrow new MarketplaceUnsupportedVersionError();\n\t}\n\n\tif (request.status === 400 && response.code === 200) {\n\t\tthrow new MarketplaceAppsError('Marketplace_Invalid_Apps_Engine_Version');\n\t}\n\n\tconst INTERNAL_MARKETPLACE_ERROR_CODES = [266, 256, 166, 221, 257, 320];\n\n\tif (request.status === 500 && INTERNAL_MARKETPLACE_ERROR_CODES.includes(response.code)) {\n\t\tthrow new MarketplaceAppsError('Marketplace_Internal_Error');\n\t}\n\n\tthrow new MarketplaceAppsError('Marketplace_Failed_To_Fetch_Apps');\n}\n","sourceCodeStart":177,"sourceCodeEnd":197,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceApps.ts#L177-L197","documentation":"Thrown by fetchMarketplaceApps as the final fallback for any non-200 marketplace response that did not match the specific 426/400-code-200/500-internal-code branches. Maps to MarketplaceAppsError('Marketplace_Failed_To_Fetch_Apps'). It is the catch-all for unmapped marketplace failures (e.g. 401, 403, 404, 429, or a 500 with an untracked code). The response is logged at error level before throwing.","triggerScenarios":"Calling fetchMarketplaceApps() when the marketplace returns a status not specifically handled: 401/403 (auth), 404 (endpoint moved), 429 (rate limit), 500 with a code outside [266,256,166,221,257,320], or any other non-200.","commonSituations":"Invalid/expired workspace token (401/403); marketplace rate limiting (429); endpoint retired after marketplace API change; unknown marketplace 500 with a new internal code not yet in the tracked list.","solutions":["Inspect server logs for the actual status and response.code - the generic message hides the detail.","Re-register the workspace if the status is 401/403.","Back off and retry if rate-limited (429).","Update Rocket.Chat if the marketplace API contract changed (404).","Report new internal 500 codes to Rocket.Chat so they can be added to the tracked list."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function classifyUnknownMarketplaceError(status: number) {\n  if (status === 401 || status === 403) return 're-register workspace';\n  if (status === 429) return 'rate-limited';\n  if (status === 404) return 'endpoint retired - upgrade';\n  return 'unknown marketplace failure';\n}","typeGuard":"import { MarketplaceAppsError } from './marketplaceErrors';\n\nconst isFailedToFetchApps = (e: unknown): e is MarketplaceAppsError =>\n  e instanceof MarketplaceAppsError && e.message === 'Marketplace_Failed_To_Fetch_Apps';","tryCatchPattern":"try {\n  return await fetchMarketplaceApps();\n} catch (e) {\n  if (e instanceof MarketplaceAppsError && e.message === 'Marketplace_Failed_To_Fetch_Apps') {\n    // generic fallback - inspect server logs for the actual status/code\n    return await retryWithBackoff(() => fetchMarketplaceApps(), { retries: 2 });\n  }\n  throw e;\n}","preventionTips":["Always inspect server logs when this generic error fires - the real status is logged but not surfaced.","Re-register the workspace on 401/403-like behaviour.","Back off on repeated failures (possible rate limit).","Report new marketplace 500 codes so they can be added to the tracked list."],"tags":["marketplace","fallback","upstream","unknown-error"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}