calcom/cal.diy · error · NotFoundException

Team with slug ${body.teamSlug} not found

Error message

Team with slug ${body.teamSlug} not found

What it means

Thrown by the Platform API v2 bookings service when resolving an event type by team slug. The service calls getBookedEventTypeTeam (which delegates to teamsRepository.findTeamBySlug) and, if no team matches the provided body.teamSlug, raises a NotFoundException (HTTP 404). This means the slug does not correspond to any team in the database, or the authenticated platform client lacks access to that team.

Source

Thrown at apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts:203

    }
  }

  async getBookedEventType(body: CreateBookingInput) {
    if (body.eventTypeId) {
      return await this.eventTypesRepository.getEventTypeByIdWithOwnerAndTeam(body.eventTypeId);
    } else if (body.username && body.eventTypeSlug) {
      const user = await this.usersRepository.findByUsername(body.username, body.organizationSlug);
      if (!user) {
        throw new NotFoundException(`User with username ${body.username} not found`);
      }
      return await this.eventTypesRepository.getUserEventTypeBySlugWithOwnerAndTeam(
        user.id,
        body.eventTypeSlug
      );
    } else if (body.teamSlug && body.eventTypeSlug) {
      const team = await this.getBookedEventTypeTeam(body.teamSlug);
      if (!team) {
        throw new NotFoundException(`Team with slug ${body.teamSlug} not found`);
      }
      return await this.teamsEventTypesRepository.getEventTypeByTeamIdAndSlugWithOwnerAndTeam(
        team.id,
        body.eventTypeSlug
      );
    }
    return null;
  }

  async getBookedEventTypeTeam(teamSlug: string) {
    return await this.teamsRepository.findTeamBySlug(teamSlug);
  }

  async hasRequiredBookingFieldsResponses(body: CreateBookingInput, eventType: EventType | null) {
    const bookingFieldsResponses: Record<string, unknown> = {
      ...body.bookingFieldsResponses,
      attendeePhoneNumber: body.attendee.phoneNumber,
      smsReminderNumber: body.attendee.phoneNumber,

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the teamSlug value against the actual team slug in Cal.com team settings (Team Settings > Profile).
  2. Call GET /v2/teams or the team listing endpoint to list available slugs for the authenticated platform client and confirm the slug exists.
  3. Ensure the platform OAuth client belongs to the same organization that owns the team.
  4. Send both teamSlug and eventTypeSlug together — if only eventTypeSlug is sent, the service will not enter the team branch at all.

Example fix

// before
const body = { teamSlug: 'acme-team', eventTypeSlug: 'intro-call' };
// after — confirm slug exists first
const teams = await client.get('/teams');
const team = teams.find(t => t.slug === 'acme-team');
if (!team) throw new Error(`Team slug not found, available: ${teams.map(t => t.slug).join(', ')}`);
const body = { teamSlug: team.slug, eventTypeSlug: 'intro-call' };
Defensive patterns

Strategy: validation

Validate before calling

const teams = await client.get('/v2/teams');
const exists = teams.some(t => t.slug === body.teamSlug);
if (!exists) throw new Error(`teamSlug '${body.teamSlug}' not found`);

Type guard

function isTeamSlugValid(slug: string, teamSlugs: string[]): slug is string {
  return typeof slug === 'string' && teamSlugs.includes(slug);
}

Try / catch

try { await client.post('/v2/bookings', body); }
catch (e) {
  if (e.status === 404 && /Team with slug/.test(e.message)) { /* re-list teams, fix slug */ }
  else throw e;
}

Prevention

When it happens

Trigger: A POST /v2/bookings request is sent with body containing both teamSlug and eventTypeSlug, but teamSlug does not match any team. For example, typo in slug, slug of a team that was deleted, or slug from a different organization/namespace than the platform client's scope.

Common situations: Hardcoding a team slug in integration code after a team is renamed; using a team slug from a different Cal.com organization; copy-paste typos; the team exists but the platform OAuth client does not have it linked to its organization.

Related errors


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