{"record":{"id":"265c6bcf4523afd7","repo":"calcom/cal.diy","slug":"email-code-and-user-id-are-required","errorCode":null,"errorMessage":"Email, code, and user ID are required","messagePattern":"Email, code, and user ID are required","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"apps/api/v2/src/modules/atoms/services/verification-atom.service.ts","lineNumber":57,"sourceCode":"      }\n      throw new BadRequestException(\"Verification failed\");\n    }\n  }\n\n  async verifyEmailCodeAuthenticated(user: UserWithProfile, input: VerifyEmailCodeInput) {\n    try {\n      return await verifyCodeAuthenticated({\n        user,\n        email: input.email,\n        code: input.code,\n      });\n    } catch (error) {\n      if (error instanceof Error) {\n        if (error.message === \"invalid_code\") {\n          throw new BadRequestException(\"Invalid verification code\");\n        }\n        if (error.message === \"BAD_REQUEST\") {\n          throw new BadRequestException(\"Email, code, and user ID are required\");\n        }\n      }\n      throw new UnauthorizedException(\"Verification failed\");\n    }\n  }\n\n  async sendEmailVerificationCode(input: SendVerificationEmailInput) {\n    return await sendEmailVerificationByCode({\n      email: input.email,\n      username: input.username,\n      language: input.language,\n      isVerifyingEmail: input.isVerifyingEmail,\n    });\n  }\n\n  async getVerifiedEmails(input: GetVerifiedEmailsInput): Promise<string[]> {\n    const { userId, userEmail, teamId } = input;\n    const userEmailWithoutOauthClientId = this.removeClientIdFromEmail(userEmail);","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/atoms/services/verification-atom.service.ts#L39-L75","documentation":"Thrown by verifyEmailCodeAuthenticated when the upstream rejects with an Error whose message equals 'BAD_REQUEST'. Like errors 23/25, this branch is unreachable today because verifyCodeAuthenticated is a stub that returns false and never throws (packages/platform/libraries/index.ts:175). The message also embeds 'user ID' to reflect that the authenticated path has the user context.","triggerScenarios":"Unreachable against the current stub. Would fire only if a real verifyCodeAuthenticated implementation throws new Error('BAD_REQUEST') on missing email/code/userId.","commonSituations":"Calling authenticated verify in community edition (no-op); enabling EE; library contract drift.","solutions":["In CE this code path is inert — verify your edition before debugging.","When implementing verifyCodeAuthenticated, prefer a typed ErrorWithCode and matching instanceof check over fragile string equality.","Add a DTO validator on VerifyEmailCodeInput so missing fields never reach this catch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!input?.email || !input?.code || !user?.id) {\n  throw new BadRequestException('Email, code, and user ID are required');\n}","typeGuard":"function hasAuthenticatedVerifyInput(u: unknown, v: unknown): v is { email: string; code: string } {\n  return typeof u === 'object' && u !== null && typeof (u as any).id === 'number' &&\n    typeof v === 'object' && v !== null &&\n    typeof (v as any).email === 'string' && typeof (v as any).code === 'string';\n}","tryCatchPattern":null,"preventionTips":["Note this branch is dead under the current stub (verifyCodeAuthenticated never throws).","Validate user/email/code presence at the DTO layer so this never reaches the catch."],"tags":["verification","dead-code","stub","input-validation","atoms-api"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}