{"record":{"id":"05d0e02ff461c61d","repo":"calcom/cal.diy","slug":"something-went-wrong","errorCode":null,"errorMessage":"Something went wrong","messagePattern":"Something went wrong","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-store/_utils/useAddAppMutation.ts","lineNumber":87,"sourceCode":"        fromApp: true,\n        ...(teamId && { teamId }),\n        ...(type === \"google_calendar\" && { installGoogleVideo: options?.installGoogleVideo }),\n        ...(returnTo && { returnTo }),\n        ...(defaultInstall && { defaultInstall }),\n      };\n\n      const stateStr = JSON.stringify(state);\n      const searchParams = generateSearchParamString({\n        stateStr,\n        teamId,\n        returnTo,\n      });\n\n      const res = await fetch(`/api/integrations/${type}/add${searchParams}`);\n\n      if (!res.ok) {\n        const errorBody = await res.json();\n        throw new Error(errorBody.message || \"Something went wrong\");\n      }\n\n      const json = await res.json();\n      const externalUrl = /https?:\\/\\//.test(json?.url) && !json?.url?.startsWith(window.location.origin);\n\n      // Check first that the URL is absolute, then check that it is of different origin from the current.\n      if (externalUrl) {\n        // TODO: For Omni installation to authenticate and come back to the page where installation was initiated, some changes need to be done in all apps' add callbacks\n        gotoUrl(json.url, json.newTab);\n        return { setupPending: !json.newTab, message: json.message };\n      } else if (json.url) {\n        gotoUrl(json.url, json.newTab);\n        return {\n          setupPending:\n            json?.url?.endsWith(\"/setup\") || json?.url?.includes(\"/apps/installation/event-types\"),\n          message: json.message,\n        };\n      } else if (returnTo) {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/packages/app-store/_utils/useAddAppMutation.ts#L69-L105","documentation":"Generic fallback thrown when the fetch to POST /api/integrations/${type}/add responds non-ok AND the JSON error body has no 'message' field. It is the last-resort message, so the real server-side cause is hidden behind this opaque string.","triggerScenarios":"The integration 'add' endpoint returns a non-2xx status with a body missing a 'message' key (e.g. {} or { error: '...' }); a reverse proxy/gateway returns an HTML error page; res.json() parsing a non-JSON body.","commonSituations":"Server-side 500 with empty body; a custom app whose add handler returns a different error shape; unknown integration slug causing a 404 with undefined message; CDN/WAF intercepting the request.","solutions":["Open DevTools Network tab and inspect the response status + body for /api/integrations/<type>/add to see the real server error.","Ensure your integration 'add' handler returns { message: string } on error so errorBody.message is populated.","Confirm 'type' resolves to a valid installed integration slug that has an add route.","Check server logs for the underlying exception corresponding to the failed add call."],"exampleFix":"// before\nconst errorBody = await res.json();\nthrow new Error(errorBody.message || 'Something went wrong');\n\n// after\nconst errorBody = await res.json().catch(() => ({}));\nthrow new Error(errorBody.message || `Install failed for ${type} (HTTP ${res.status})`);","handlingStrategy":"try-catch","validationCode":"const res = await fetch(`/api/integrations/${type}/add${searchParams}`);\nif (!res.ok) {\n  const errorBody = await res.json().catch(() => ({}));\n  throw new Error(errorBody.message || `Install failed for ${type} (HTTP ${res.status})`);\n}","typeGuard":"const hasMessage = (b: unknown): b is { message: string } =>\n  typeof b === 'object' && b !== null && typeof (b as any).message === 'string';","tryCatchPattern":"try {\n  await mutation.mutateAsync(vars);\n} catch (err) {\n  if (err.message === 'Something went wrong') {\n    // surface the network response status from DevTools; the server cause is hidden\n  }\n}","preventionTips":["Always return { message } from integration add handlers on error.","Log res.status alongside the fallback so the opaque case is traceable.","Validate the integration slug exists before calling add."],"tags":["network","integration","fallback","error-handling"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}