{"record":{"id":"f3c7d29ead918baa","repo":"calcom/cal.diy","slug":"event-type-with-slug-body-eventtypeslug-belongi-f3c7d2","errorCode":null,"errorMessage":"Event type with slug ${body.eventTypeSlug} belonging to team ${body.teamSlug} within organization ${body.organizationSlug} not found.","messagePattern":"Event type with slug (.+?) belonging to team (.+?) within organization (.+?) 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":27,"sourceCode":"\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);\n        }\n        throw new BadRequestException(\"User either already has booking at this time or is not available\");\n      } else if (error.message === \"booking_time_out_of_bounds_error\") {\n        throw new BadRequestException(\n          `The event type can't be booked at the \"start\" time provided. This could be because it's too soon (violating the minimum booking notice) or too far in the future (outside the event's scheduling window). Try fetching available slots first using the GET /v2/slots endpoint and then make a booking with \"start\" time equal to one of the available slots.`","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/platform/bookings/2024-08-13/services/errors.service.ts#L9-L45","documentation":"Thrown by handleEventTypeToBeBookedNotFound when the booking body contains teamSlug + eventTypeSlug + organizationSlug and no matching org-scoped team event type was resolved. NotFoundException (HTTP 404). This is the org-aware variant of error 323.","triggerScenarios":"POST /v2/bookings with { teamSlug, eventTypeSlug, organizationSlug } where the team is not in that organization, the slug is wrong, the event type belongs to a different team in the org, or the org/team combination does not exist.","commonSituations":"Team moved between orgs during a reorg; organizationSlug from a stale config; team is a non-org team but the caller passed an org slug; event type demoted from team to user scope.","solutions":["List org teams and their event types via the organization endpoint to confirm teamSlug + organizationSlug + eventTypeSlug match.","Drop organizationSlug if the team is a standalone (non-org) team so the 323 branch applies.","Re-fetch the current organizationSlug after any tenant restructure.","Verify the event type still belongs to the team."],"exampleFix":"// before\nbody: { teamSlug: 'sales', eventTypeSlug: 'demo', organizationSlug: 'wrong-org' }\n\n// after\nbody: { teamSlug: 'sales', eventTypeSlug: 'demo', organizationSlug: 'acme' }","handlingStrategy":"validation","validationCode":"const et = await api.get(`/v2/event-types?teamSlug=${body.teamSlug}&organizationSlug=${body.organizationSlug}`);\nif (!et.data.some(e => e.slug === body.eventTypeSlug)) throw new Error('org team event type not found');","typeGuard":"const hasOrgTeamSlugCombo = (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 && /team.*within organization/.test(e.response.data.message)) {\n    /* re-resolve teamSlug and organizationSlug */\n  } else throw e;\n}","preventionTips":["Re-fetch organization and team slugs after any tenant restructure.","Drop organizationSlug if the team is standalone.","Validate the event type still belongs to the team within the org."],"tags":["api","bookings","event-types","teams","organizations","not-found","nestjs"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}