{"record":{"id":"b97235c12513879c","repo":"RocketChat/Rocket.Chat","slug":"result-error-b97235","errorCode":null,"errorMessage":"result.error","messagePattern":"result\\.error","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/ee/server/apps/communication/rest.ts","lineNumber":647,"sourceCode":"\t\t\t\t\tconst headers = getDefaultHeaders();\n\n\t\t\t\t\tconst token = await getWorkspaceAccessToken();\n\t\t\t\t\tif (token) {\n\t\t\t\t\t\theaders.Authorization = `Bearer ${token}`;\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst request = await orchestrator\n\t\t\t\t\t\t\t.getMarketplaceClient()\n\t\t\t\t\t\t\t.fetch(`v1/app-request?appId=${appId}&q=${q}&sort=${sort}&limit=${limit}&offset=${offset}`, {\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\t// SECURITY: user needs specific privileges to send this. Bypassing the SSRF check is okay for now.\n\t\t\t\t\t\t\t\tignoreSsrfValidation: true,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\tconst result = await request.json();\n\n\t\t\t\t\t\tif (!request.ok) {\n\t\t\t\t\t\t\tthrow new Error(result.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn API.v1.success(result);\n\t\t\t\t\t} catch (err: any) {\n\t\t\t\t\t\torchestrator.getRocketChatLogger().error({ msg: 'Error getting the app requests from marketplace', err });\n\n\t\t\t\t\t\treturn API.v1.failure(err.message);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\tthis.api.addRoute(\n\t\t\t'app-request/stats',\n\t\t\t{ authRequired: true },\n\t\t\t{\n\t\t\t\tasync get() {\n\t\t\t\t\tconst headers = getDefaultHeaders();\n","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/apps/communication/rest.ts#L629-L665","documentation":"Thrown by GET /app-request when the marketplace responds with a non-ok HTTP status. The handler reads result = await request.json() and throws new Error(result.error), so the error message is whatever the marketplace put in its error field (could be undefined). The surrounding catch returns API.v1.failure(err.message). This endpoint proxies the marketplace's app-request (feature requests) listing.","triggerScenarios":"GET /api/v1/app-request?appId=...&q=...&sort=...&limit=...&offset=... where the upstream marketplace returns 4xx/5xx. Common when the workspace token is invalid, the marketplace is rate-limiting, or the appId query has no matching requests.","commonSituations":"Unregistered workspace (no valid token); marketplace outage or 5xx; rate limiting from too many app-request polls; client passed an appId the marketplace does not recognize.","solutions":["Register/re-register the workspace with Rocket.Chat Cloud so the Bearer token is valid.","Retry after a short delay if the marketplace returned a transient 5xx.","Reduce polling frequency to avoid rate limits.","Inspect the marketplace response body: if result.error is undefined the surfaced message will be 'undefined' - check server logs for the logged err object."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"async function canProxyMarketplace(): Promise<boolean> {\n  try {\n    const res = await fetch('/api/v1/app-request?appId=test&limit=1');\n    return res.ok;\n  } catch { return false; }\n}","typeGuard":"const hasErrorField = (result: unknown): result is { error: string } =>\n  typeof result === 'object' && result !== null &&\n  typeof (result as any).error === 'string';","tryCatchPattern":"try {\n  const data = await fetch('/api/v1/app-request?' + params).then(r => r.json());\n} catch (e) {\n  // result.error from marketplace propagates as err.message\n  if (e instanceof Error && /unauthorized|token/i.test(e.message)) {\n    reRegisterWorkspace();\n  } else {\n    backoffAndRetry();\n  }\n}","preventionTips":["Keep workspace registration current.","Poll app-request at low frequency to avoid rate limits.","Treat app-request failures as non-critical in the UI.","Inspect server logs because result.error may be undefined (surface 'undefined')."],"tags":["apps-engine","marketplace","app-request","network"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}