calcom/cal.diy · error · Error

Teams are not supported

Error message

Teams are not supported

What it means

Thrown by ensureValidResourceOwner inside the OAuthManager constructor when credential sync is enabled (useCredentialSync === true) and the resourceOwner.type is 'team'. Credential syncing is implemented only for user-scoped credentials, so instantiating an OAuthManager for a team credential in sync mode is unsupported by design.

Source

Thrown at packages/app-store/_utils/oauth/OAuthManager.ts:613

    // Any handlable not ok response should be handled through isTokenObjectUnusable or isAccessTokenUnusable but if still not handled, we should throw an error
    // So, that the caller can handle it. It could be a network error or some other temporary error from the third party App itself.
    if (isNotOkay) {
      return {
        tokenStatus: TokenStatus.INCONCLUSIVE,
        invalidReason: response.statusText,
        json,
      };
    }

    return { tokenStatus: TokenStatus.VALID, json, invalidReason: null } as const;
  }
}

function ensureValidResourceOwner(
  resourceOwner: { id: number | null; type: "team" } | { id: number | null; type: "user" }
) {
  if (resourceOwner.type === "team") {
    throw new Error("Teams are not supported");
  } else {
    if (!resourceOwner.id) {
      throw new Error("resourceOwner should have id set");
    }
  }
}

/**
 * It converts error into a Response
 */
function handleFetchError(e: unknown) {
  const myLog = log.getSubLogger({ prefix: ["handleFetchError"] });
  myLog.debug("Error", safeStringify(e));
  if (e instanceof Error) {
    return new Response(JSON.stringify({ myFetchError: e.message }), { status: 500 });
  }
  return new Response(JSON.stringify({ myFetchError: "UNKNOWN_ERROR" }), { status: 500 });
}

View on GitHub (pinned to 176037d0af)

Solutions

  1. Do not enable credential sync for team-scoped OAuth apps; keep team credentials local.
  2. Route team OAuth flows through a non-sync OAuthManager (omit credentialSyncVariables so useCredentialSync is false).
  3. Ensure resourceOwner.type is 'user' with a valid id when sync is on.
  4. If you need team sync, extend the sync server and remove this guard deliberately.

Example fix

// before - sync enabled for a team credential
new OAuthManager({
  resourceOwner: { id: teamId, type: 'team' },
  credentialSyncVariables: syncVars, // throws 'Teams are not supported'
});
// after - only use sync for user owners
if (resourceOwner.type === 'user') {
  new OAuthManager({ resourceOwner, credentialSyncVariables: syncVars });
} else {
  new OAuthManager({ resourceOwner }); // local token management
}
Defensive patterns

Strategy: validation

Validate before calling

if (useCredentialSync && resourceOwner.type === 'team') {
  throw new Error('Credential sync does not support team-owned credentials; disable sync for this flow.');
}

Type guard

type ResourceOwner = { id: number | null; type: 'team' | 'user' };
function isUserOwner(o: ResourceOwner): o is { id: number; type: 'user' } {
  return o.type === 'user' && typeof o.id === 'number';
}

Try / catch

null

Prevention

When it happens

Trigger: An OAuthManager is constructed for a team-owned credential (resourceOwner.type === 'team') while APP_CREDENTIAL_SHARING_ENABLED, CREDENTIAL_SYNC_ENDPOINT, SECRET_HEADER, and SECRET are all set. The constructor calls ensureValidResourceOwner only in sync mode, which rejects team owners immediately.

Common situations: Enabling credential sharing globally without realizing team OAuth credentials are not supported by the sync server; a team install flow (e.g. team Zoom/Google) running under credential-sync env config; misclassifying a user credential as a team credential when building the resourceOwner.

Related errors


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