{"record":{"id":"a9a19f8df5869407","repo":"RocketChat/Rocket.Chat","slug":"failed-to-get-categories","errorCode":null,"errorMessage":"Failed to get categories","messagePattern":"Failed to get categories","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/client/apps/orchestrator.ts","lineNumber":179,"sourceCode":"\t\t\tappVersion,\n\t\t\taction,\n\t\t});\n\n\t\tif ('url' in result) {\n\t\t\treturn result;\n\t\t}\n\n\t\tthrow new Error('Failed to build external url');\n\t}\n\n\tpublic async getCategories(): Promise<Serialized<ICategory[]>> {\n\t\tconst result = await sdk.rest.get('/apps/categories');\n\n\t\tif (Array.isArray(result)) {\n\t\t\t// TODO: chapter day: multiple results are returned, but we only need one\n\t\t\treturn result as Serialized<ICategory>[];\n\t\t}\n\t\tthrow new Error('Failed to get categories');\n\t}\n}\n\nexport const AppClientOrchestratorInstance = new AppClientOrchestrator();\n","sourceCodeStart":161,"sourceCodeEnd":184,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/client/apps/orchestrator.ts#L161-L184","documentation":"Thrown by AppClientOrchestrator.getCategories when GET /apps/categories does not return an Array. The method uses Array.isArray(result) as the structural guard because the typing is loose; a non-array (object envelope, error body, null) is treated as an invalid response.","triggerScenarios":"The categories endpoint returns an object envelope (e.g. { categories: [...] }) instead of a bare array, an error object with HTTP 200, null, or the marketplace is disabled so the route returns a different body.","commonSituations":"Marketplace disabled; server version returning a wrapped envelope; proxy error page; the categories list is empty but wrapped in an object; apps-engine microservice migration changing the shape.","solutions":["Inspect the raw /apps/categories response body to see whether it is wrapped or an error.","Ensure the marketplace is enabled and reachable.","If the server wraps results in an envelope, update the rest-typings and the guard accordingly (e.g. check 'categories' in result).","Confirm server/client version compatibility."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isCategoryArray(r: unknown): r is ICategory[] {\n  return Array.isArray(r);\n}","tryCatchPattern":"try {\n  const cats = await orchestrator.getCategories();\n} catch (e) {\n  if ((e as Error).message === 'Failed to get categories') {\n    // inspect raw /apps/categories body; may be wrapped envelope\n  }\n}","preventionTips":["Ensure the marketplace is enabled and reachable.","If the server wraps results, update the guard and rest-typings together.","Verify server/client version compatibility."],"tags":["apps-engine","marketplace","rest","response-shape","categories"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}