{"record":{"id":"15e25b53d05b8804","repo":"RocketChat/Rocket.Chat","slug":"marketplace-failed-to-fetch-categories","errorCode":null,"errorMessage":"Marketplace_Failed_To_Fetch_Categories","messagePattern":"Marketplace_Failed_To_Fetch_Categories","errorType":"error_code","errorClass":"MarketplaceAppsError","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts","lineNumber":75,"sourceCode":"\t\treturn response;\n\t}\n\n\tconst response = await request.json();\n\n\tApps.getRocketChatLogger().error({ msg: 'Error fetching marketplace categories', 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\tconst INTERNAL_MARKETPLACE_ERROR_CODES = [189, 266];\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_Categories');\n}\n","sourceCodeStart":57,"sourceCodeEnd":77,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/apps/marketplace/fetchMarketplaceCategories.ts#L57-L77","documentation":"The catch-all marketplace failure: thrown by `fetchMarketplaceCategories()` for any non-200 response that is not the specific 426 'unsupported version' case nor the 500 internal-error-code case. It indicates the categories endpoint could be reached and parsed but returned an unexpected status (e.g. 401, 403, 404, 502, 503). The response status and body are logged before throwing.","triggerScenarios":"The marketplace client's `fetch('v1/categories')` returns a status other than 200, other than 426-with-`errorMsg==='unsupported version'`, and other than 500-with-code 189/266. Common triggers: expired/revoked workspace access token (401/403), missing token, cloud routing error (502/503/504), or a malformed request.","commonSituations":"Workspace registration/token expired or never obtained (`getWorkspaceAccessToken()` returned falsy so no Authorization header was sent); cloud load balancer returning 502/503 during maintenance; SSRF allowlist misconfiguration causing a proxy rejection that surfaces as a non-200.","solutions":["Verify workspace registration and that a valid cloud token exists (re-register the workspace in Administration > Connectivity Services).","Check the logged `status` value: 401/403 points to token/auth, 5xx points to cloud-side or network proxy issues.","Confirm `SSRF_Allowlist` setting is not blocking the marketplace host and that the server can reach the cloud endpoint.","Retry after re-registering; if status is 5xx, treat as transient and retry with backoff."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { getWorkspaceAccessToken } from '../../../../server/lib/cloud';\n\nasync function canReachMarketplace(): Promise<boolean> {\n\tconst token = await getWorkspaceAccessToken();\n\tif (!token) return false; // no auth token → likely 401/403\n\treturn true;\n}","typeGuard":"import { MarketplaceAppsError } from './marketplaceErrors';\n\nfunction isMarketplaceFetchCategoriesError(e: unknown): boolean {\n\treturn e instanceof MarketplaceAppsError && e.message === 'Marketplace_Failed_To_Fetch_Categories';\n}","tryCatchPattern":"try {\n\tconst categories = await fetchMarketplaceCategories();\n} catch (e) {\n\tif (e instanceof MarketplaceAppsError) {\n\t\t// inspect logged status; 401/403 → re-register workspace, 5xx → retry\n\t}\n\tthrow e;\n}","preventionTips":["Keep workspace registration and cloud access token valid.","Monitor the SSRF allowlist so the marketplace host is reachable.","Distinguish auth failures (re-register) from cloud outages (retry)."],"tags":["marketplace","network","cloud","auth","ee"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}