{"record":{"id":"131bacc15d5ca6d7","repo":"calcom/cal.diy","slug":"team-with-slug-body-teamslug-not-found","errorCode":null,"errorMessage":"Team with slug ${body.teamSlug} not found","messagePattern":"Team with slug (.+?) not found","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts","lineNumber":203,"sourceCode":"    }\n  }\n\n  async getBookedEventType(body: CreateBookingInput) {\n    if (body.eventTypeId) {\n      return await this.eventTypesRepository.getEventTypeByIdWithOwnerAndTeam(body.eventTypeId);\n    } else if (body.username && body.eventTypeSlug) {\n      const user = await this.usersRepository.findByUsername(body.username, body.organizationSlug);\n      if (!user) {\n        throw new NotFoundException(`User with username ${body.username} not found`);\n      }\n      return await this.eventTypesRepository.getUserEventTypeBySlugWithOwnerAndTeam(\n        user.id,\n        body.eventTypeSlug\n      );\n    } else if (body.teamSlug && body.eventTypeSlug) {\n      const team = await this.getBookedEventTypeTeam(body.teamSlug);\n      if (!team) {\n        throw new NotFoundException(`Team with slug ${body.teamSlug} not found`);\n      }\n      return await this.teamsEventTypesRepository.getEventTypeByTeamIdAndSlugWithOwnerAndTeam(\n        team.id,\n        body.eventTypeSlug\n      );\n    }\n    return null;\n  }\n\n  async getBookedEventTypeTeam(teamSlug: string) {\n    return await this.teamsRepository.findTeamBySlug(teamSlug);\n  }\n\n  async hasRequiredBookingFieldsResponses(body: CreateBookingInput, eventType: EventType | null) {\n    const bookingFieldsResponses: Record<string, unknown> = {\n      ...body.bookingFieldsResponses,\n      attendeePhoneNumber: body.attendee.phoneNumber,\n      smsReminderNumber: body.attendee.phoneNumber,","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/bookings.service.ts#L185-L221","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the teamSlug value against the actual team slug in Cal.com team settings (Team Settings > Profile).","Call GET /v2/teams or the team listing endpoint to list available slugs for the authenticated platform client and confirm the slug exists.","Ensure the platform OAuth client belongs to the same organization that owns the team.","Send both teamSlug and eventTypeSlug together — if only eventTypeSlug is sent, the service will not enter the team branch at all."],"exampleFix":"// before\nconst body = { teamSlug: 'acme-team', eventTypeSlug: 'intro-call' };\n// after — confirm slug exists first\nconst teams = await client.get('/teams');\nconst team = teams.find(t => t.slug === 'acme-team');\nif (!team) throw new Error(`Team slug not found, available: ${teams.map(t => t.slug).join(', ')}`);\nconst body = { teamSlug: team.slug, eventTypeSlug: 'intro-call' };","handlingStrategy":"validation","validationCode":"const teams = await client.get('/v2/teams');\nconst exists = teams.some(t => t.slug === body.teamSlug);\nif (!exists) throw new Error(`teamSlug '${body.teamSlug}' not found`);","typeGuard":"function isTeamSlugValid(slug: string, teamSlugs: string[]): slug is string {\n  return typeof slug === 'string' && teamSlugs.includes(slug);\n}","tryCatchPattern":"try { await client.post('/v2/bookings', body); }\ncatch (e) {\n  if (e.status === 404 && /Team with slug/.test(e.message)) { /* re-list teams, fix slug */ }\n  else throw e;\n}","preventionTips":["Cache the list of valid team slugs per platform client","Validate slugs against a fetched list before booking","Use a constant or config enum for known team slugs"],"tags":["api-v2","bookings","team","not-found","validation"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}