{"record":{"id":"30a96710e60cb901","repo":"calcom/cal.diy","slug":"event-type-with-slug-body-eventtypeslug-belongi-30a967","errorCode":null,"errorMessage":"Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} not found.","messagePattern":"Event type with slug (.+?) belonging to team (.+?) not found\\.","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/platform/bookings/2024-08-13/services/errors.service.ts","lineNumber":22,"sourceCode":"import { CreateBookingInput } from \"@calcom/platform-types\";\n\n@Injectable()\nexport class ErrorsBookingsService_2024_08_13 {\n  private readonly logger = new Logger(\"ErrorsBookingsService_2024_08_13\");\n\n  handleEventTypeToBeBookedNotFound(body: CreateBookingInput): never {\n    if (body.username && body.eventTypeSlug && !body.organizationSlug) {\n      throw new NotFoundException(\n        `Event type with slug ${body.eventTypeSlug} belonging to user ${body.username} not found.`\n      );\n    }\n    if (body.username && body.eventTypeSlug && body.organizationSlug) {\n      throw new NotFoundException(\n        `Event type with slug ${body.eventTypeSlug} belonging to user ${body.username} within organization ${body.organizationSlug} not found.`\n      );\n    }\n    if (body.teamSlug && body.eventTypeSlug && !body.organizationSlug) {\n      throw new NotFoundException(\n        `Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} not found.`\n      );\n    }\n    if (body.teamSlug && body.eventTypeSlug && body.organizationSlug) {\n      throw new NotFoundException(\n        `Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} within organization ${body.organizationSlug} not found.`\n      );\n    }\n    throw new NotFoundException(`Event type with id ${body.eventTypeId} not found.`);\n  }\n\n  handleBookingError(error: unknown, bookingTeamEventType: boolean): never {\n    const hostsUnavaile = \"One of the hosts either already has booking at this time or is not available\";\n\n    if (error instanceof Error) {\n      if (error.message === \"no_available_users_found_error\") {\n        if (bookingTeamEventType) {\n          throw new BadRequestException(hostsUnavaile);","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/errors.service.ts#L4-L40","documentation":"Thrown by handleEventTypeToBeBookedNotFound when the booking body contains teamSlug + eventTypeSlug (no organizationSlug) and no matching team-owned event type was resolved. NotFoundException (HTTP 404). This is the team analogue of error 321.","triggerScenarios":"POST /v2/bookings with { teamSlug, eventTypeSlug } where the team slug is wrong, the event type is not owned by that team, or the team is inside an organization (which requires organizationSlug and triggers the 324 branch instead).","commonSituations":"Team was renamed; event type reassigned from one team to another; team lives inside an org but the caller omitted organizationSlug; team event type is unpublished; slug casing mismatch (team slugs can be case-sensitive).","solutions":["List team event types via GET /v2/event-types?teamSlug={teamSlug} to confirm the slug before booking.","If the team is inside an organization, add organizationSlug so the 324 branch resolves.","Verify teamSlug casing and remove trailing whitespace.","Confirm the event type is published and assigned to the team."],"exampleFix":"// before\nbody: { teamSlug: 'Sales ', eventTypeSlug: 'demo' }\n\n// after\nbody: { teamSlug: 'sales', eventTypeSlug: 'demo' }","handlingStrategy":"validation","validationCode":"const teamSlug = body.teamSlug?.trim().toLowerCase();\nconst eventTypeSlug = body.eventTypeSlug?.trim();\nconst et = await api.get(`/v2/event-types?teamSlug=${encodeURIComponent(teamSlug)}`);\nif (!et.data.some(e => e.slug === eventTypeSlug)) throw new Error('team event type not found');","typeGuard":"const hasTeamSlugCombo = (b: CreateBookingInput): boolean =>\n  !!(b.teamSlug && b.eventTypeSlug && !b.organizationSlug);","tryCatchPattern":"try { await api.post('/v2/bookings', body); }\ncatch (e) {\n  if (e.response?.status === 404 && /belonging to team/.test(e.response.data.message)) {\n    /* verify teamSlug casing or add organizationSlug if team is org-scoped */\n  } else throw e;\n}","preventionTips":["Confirm the team slug casing and ownership before booking.","Add organizationSlug when the team is inside an organization.","Pre-fetch team event types to validate the slug."],"tags":["api","bookings","event-types","teams","not-found","nestjs"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}