calcom/cal.diy · warning · HttpError

No credential found for user

Error message

No credential found for user

What it means

Thrown when the authenticated user has no Basecamp 3 credential row in the DB. The mutation cannot proceed without an OAuth access token to call Basecamp. Surfaced as HTTP 403.

Source

Thrown at packages/app-store/basecamp3/api/projectMutation.ts:43

  const parsed = ZProjectMutationInputSchema.safeParse(req.body ?? {});
  if (!parsed.success) {
    throw new HttpError({
      statusCode: 400,
      message: "Invalid request body",
    });
  }
  const { projectId } = parsed.data;

  const { user_agent } = await getAppKeysFromSlug("basecamp3");

  const credential = await prisma.credential.findFirst({
    where: { userId },
    select: credentialForCalendarServiceSelect,
  });

  if (!credential) {
    throw new HttpError({ statusCode: 403, message: "No credential found for user" });
  }

  let credentialKey = credential.key as BasecampToken;

  if (credentialKey.expires_at < Date.now()) {
    credentialKey = (await refreshAccessToken(credential)) as BasecampToken;
  }

  const basecampUserId = credentialKey.account.id;
  const scheduleResponse = await fetch(
    `https://3.basecampapi.com/${basecampUserId}/projects/${projectId}.json`,
    {
      headers: {
        "User-Agent": user_agent as string,
        Authorization: `Bearer ${credentialKey.access_token}`,
      },
    }
  );

View on GitHub (pinned to 176037d0af)

Solutions

  1. Complete the Basecamp 3 OAuth connect flow first so a credential row is created.
  2. Verify a credential row exists for the user before exposing the project mutation UI.
  3. Re-install the Basecamp 3 app if it was removed.
Defensive patterns

Strategy: validation

Validate before calling

const credential = await prisma.credential.findFirst({
  where: { userId },
  select: credentialForCalendarServiceSelect,
});
if (!credential) {
  // hide the project mutation UI; prompt the user to connect Basecamp first
}

Prevention

When it happens

Trigger: User opened the Basecamp settings before completing the OAuth connect step; the credential was deleted; the request is for a different user account that never connected Basecamp.

Common situations: User skipped the connect step; uninstall removed the credential; multiple accounts and the active one lacks the credential.

Related errors


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