{"record":{"id":"34272f66e09dbdc7","repo":"calcom/cal.diy","slug":"team-with-slug-input-teamslug-not-found","errorCode":null,"errorMessage":"Team with slug ${input.teamSlug} not found","messagePattern":"Team with slug (.+?) not found","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots-input.service.ts","lineNumber":110,"sourceCode":"  }\n\n  private async getEventType(input: GetSlotsInput_2024_09_04) {\n    if (input.type === ById_2024_09_04_type) {\n      return this.eventTypeRepository.getEventTypeById(input.eventTypeId);\n    }\n\n    if (input.type === ByUsernameAndEventTypeSlug_2024_09_04_type) {\n      const user = await this.getEventTypeUser(input);\n      if (!user) {\n        throw new NotFoundException(`User with username ${input.username} not found`);\n      }\n      return this.eventTypeRepository.getUserEventTypeBySlug(user.id, input.eventTypeSlug);\n    }\n\n    if (input.type === ByTeamSlugAndEventTypeSlug_2024_09_04_type) {\n      const team = await this.getEventTypeTeam(input);\n      if (!team) {\n        throw new NotFoundException(`Team with slug ${input.teamSlug} not found`);\n      }\n      return this.teamsEventTypesRepository.getEventTypeByTeamIdAndSlug(team.id, input.eventTypeSlug);\n    }\n\n    return input.duration ? { ...dynamicEvent, length: input.duration } : dynamicEvent;\n  }\n\n  private async getEventTypeUser(input: ByUsernameAndEventTypeSlug_2024_09_04) {\n    return await this.usersRepository.findByUsername(input.username);\n  }\n\n  private async getEventTypeTeam(input: ByTeamSlugAndEventTypeSlug_2024_09_04) {\n    return await this.teamsRepository.findTeamBySlug(input.teamSlug);\n  }\n\n  private adjustStartTime(startTime: string) {\n    let dateTime = DateTime.fromISO(startTime, { zone: \"utc\" });\n    if (dateTime.hour === 0 && dateTime.minute === 0 && dateTime.second === 0) {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots-input.service.ts#L92-L128","documentation":"A NestJS NotFoundException (HTTP 404) thrown by SlotsInputService_2024_09_04.getEventType when resolving an event type by team slug + event-type slug. teamsRepository.findTeamBySlug(input.teamSlug) returned null, meaning no team matches the given slug. The thrown message includes the bad slug.","triggerScenarios":"Calling GET /v2/slots/2024-09-04 with type === \"teamSlugAndEventTypeSlug\" where `teamSlug` does not correspond to any team (typo, renamed team, team is part of an org and slug scoping is off, slug has trailing whitespace).","commonSituations":"Stale configuration referencing a renamed team; copying a slug from the UI that includes leading/trailing spaces or the display name instead of the slug; org teams requiring an organizationSlug qualifier.","solutions":["Fetch the team list via the teams API and confirm the exact team slug before requesting slots.","Trim whitespace and URL-decode the teamSlug before sending it.","If the team belongs to an organization, pass organizationSlug so the slug resolves in the correct scope.","Map the 404 to a user-facing 'team not found' error and re-prompt for the booking link."],"exampleFix":"// before\nfetch(`/v2/slots?teamSlug=${teamName}&eventTypeSlug=group`)\n\n// after\nconst team = await calApi.teams.getBySlug(teamSlug.trim().toLowerCase());\nif (!team) throw new ClientError(`Team '${teamSlug}' does not exist`);\nfetch(`/v2/slots?teamSlug=${encodeURIComponent(team.slug)}&eventTypeSlug=group`);","handlingStrategy":"validation","validationCode":"function normalizeTeamSlug(slug: unknown): string {\n  if (typeof slug !== 'string' || slug.trim() === '') {\n    throw new TypeError('teamSlug must be a non-empty string');\n  }\n  return slug.trim().toLowerCase();\n}\nconst teamSlug = normalizeTeamSlug(input.teamSlug);\nconst team = await cal.teams.getBySlug(teamSlug);\nif (!team) throw new ClientError(`Team '${teamSlug}' not found`);","typeGuard":"function isByTeamSlugAndEventTypeSlug(value: unknown): value is { teamSlug: string; eventTypeSlug: string } {\n  return typeof value === 'object' && value !== null\n    && typeof (value as any).teamSlug === 'string'\n    && typeof (value as any).eventTypeSlug === 'string';\n}","tryCatchPattern":"try {\n  await cal.slots.list({ type: 'teamSlugAndEventTypeSlug', teamSlug, eventTypeSlug, start, end });\n} catch (e) {\n  if (e instanceof HttpError && e.statusCode === 404) {\n    throw new UserFacingError('Team booking link is invalid');\n  }\n  throw e;\n}","preventionTips":["Source team slugs from the teams API, not the UI display name.","Trim and lowercase slugs before sending.","Include organizationSlug when the team is org-scoped.","Do not retry the same slug on 404 — it will keep failing."],"tags":["calcom-api","slots","not-found","nest","team-lookup"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}