{"record":{"id":"4983ee0252f2f9a4","repo":"RocketChat/Rocket.Chat","slug":"await-response-json-error","errorCode":null,"errorMessage":"(await response.json()).error","messagePattern":"\\(await response\\.json\\(\\)\\)\\.error","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts","lineNumber":27,"sourceCode":"export async function startRegisterWorkspaceSetupWizard(resend = false, email: string): Promise<CloudRegistrationIntentData> {\n\tassertNotOfflineLicense();\n\n\tconst regInfo = await buildWorkspaceRegistrationData(email);\n\n\tlet payload;\n\ttry {\n\t\tconst cloudUrl = settings.get<string>('Cloud_Url');\n\t\tconst response = await fetch(`${cloudUrl}/api/v2/register/workspace/intent`, {\n\t\t\tbody: regInfo,\n\t\t\tmethod: 'POST',\n\t\t\tparams: {\n\t\t\t\tresent: resend,\n\t\t\t},\n\t\t\t// SECURITY: the URL is a default hardcoded value or an envvar/setting set by an admin. It's safe to disable this check.\n\t\t\tignoreSsrfValidation: true,\n\t\t});\n\t\tif (!response.ok) {\n\t\t\tthrow new Error((await response.json()).error);\n\t\t}\n\n\t\tpayload = await response.json();\n\t} catch (err: any) {\n\t\tSystemLogger.error({\n\t\t\tmsg: 'Failed to register workspace intent with Rocket.Chat Cloud',\n\t\t\turl: '/api/v2/register/workspace',\n\t\t\terr,\n\t\t});\n\n\t\tthrow err;\n\t}\n\n\tif (!payload) {\n\t\tthrow new Error('Failed to fetch registration intent endpoint');\n\t}\n\n\treturn payload;","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/cloud/startRegisterWorkspaceSetupWizard.ts#L9-L45","documentation":"startRegisterWorkspaceSetupWizard POSTs the workspace registration intent to cloud /api/v2/register/workspace/intent. On a non-ok response it throws the 'error' field parsed from the cloud's JSON body — so the actual message you see is whatever validation the cloud performed (invalid email, invalid payload, rejected workspace data).","triggerScenarios":"The Setup Wizard registration step where the cloud rejects the intent payload: empty or malformed Organization_Email, invalid Site_Name/device registration info, or stricter cloud-side validation than this server version expects.","commonSituations":"Organization_Email never configured or with a bad format; older server talking to a newer cloud API; Cloud_Url pointing at the wrong environment; device registration info rejected by policy.","solutions":["Read the thrown message — it is the cloud's own validation error text naming the offending field.","Set a valid Organization_Email (and Site_Name) in the Setup Wizard / admin settings and retry.","Verify Cloud_Url and update the server to a supported release.","Check the SystemLogger entry 'Failed to register workspace intent with Rocket.Chat Cloud' for full context."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const email = settings.get<string>('Organization_Email') ?? '';\nif (!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(email)) {\n  throw new Error('set a valid Organization_Email before registering with cloud');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const payload = await startRegisterWorkspaceSetupWizard(regInfo, resend);\n} catch (e) {\n  if (e instanceof Error) {\n    // the thrown message is the cloud's own validation text — surface it next to the offending wizard field\n  }\n  throw e;\n}","preventionTips":["Fill Organization_Email and Site_Name with valid values before the wizard's register step.","Keep the server updated so the intent payload matches current cloud validation.","Log the SystemLogger context entry whenever an intent fails to capture the request shape that was rejected."],"tags":["rocket-chat","cloud","setup-wizard","registration"],"backgroundTag":"cloud-registration-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}