calcom/cal.diy · error · Error

Something went wrong

Error message

Something went wrong

What it means

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.

Source

Thrown at packages/app-store/_utils/useAddAppMutation.ts:87

        fromApp: true,
        ...(teamId && { teamId }),
        ...(type === "google_calendar" && { installGoogleVideo: options?.installGoogleVideo }),
        ...(returnTo && { returnTo }),
        ...(defaultInstall && { defaultInstall }),
      };

      const stateStr = JSON.stringify(state);
      const searchParams = generateSearchParamString({
        stateStr,
        teamId,
        returnTo,
      });

      const res = await fetch(`/api/integrations/${type}/add${searchParams}`);

      if (!res.ok) {
        const errorBody = await res.json();
        throw new Error(errorBody.message || "Something went wrong");
      }

      const json = await res.json();
      const externalUrl = /https?:\/\//.test(json?.url) && !json?.url?.startsWith(window.location.origin);

      // Check first that the URL is absolute, then check that it is of different origin from the current.
      if (externalUrl) {
        // 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
        gotoUrl(json.url, json.newTab);
        return { setupPending: !json.newTab, message: json.message };
      } else if (json.url) {
        gotoUrl(json.url, json.newTab);
        return {
          setupPending:
            json?.url?.endsWith("/setup") || json?.url?.includes("/apps/installation/event-types"),
          message: json.message,
        };
      } else if (returnTo) {

View on GitHub (pinned to 176037d0af)

Solutions

  1. Open DevTools Network tab and inspect the response status + body for /api/integrations/<type>/add to see the real server error.
  2. Ensure your integration 'add' handler returns { message: string } on error so errorBody.message is populated.
  3. Confirm 'type' resolves to a valid installed integration slug that has an add route.
  4. Check server logs for the underlying exception corresponding to the failed add call.

Example fix

// before
const errorBody = await res.json();
throw new Error(errorBody.message || 'Something went wrong');

// after
const errorBody = await res.json().catch(() => ({}));
throw new Error(errorBody.message || `Install failed for ${type} (HTTP ${res.status})`);
Defensive patterns

Strategy: try-catch

Validate before calling

const res = await fetch(`/api/integrations/${type}/add${searchParams}`);
if (!res.ok) {
  const errorBody = await res.json().catch(() => ({}));
  throw new Error(errorBody.message || `Install failed for ${type} (HTTP ${res.status})`);
}

Type guard

const hasMessage = (b: unknown): b is { message: string } =>
  typeof b === 'object' && b !== null && typeof (b as any).message === 'string';

Try / catch

try {
  await mutation.mutateAsync(vars);
} catch (err) {
  if (err.message === 'Something went wrong') {
    // surface the network response status from DevTools; the server cause is hidden
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/05d0e02ff461c61d. Report an issue: GitHub.