{"record":{"id":"dfa8fe81cff123bc","repo":"twentyhq/twenty","slug":"email-and-password-are-required","errorCode":null,"errorMessage":"Email and password are required","messagePattern":"Email and password are required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts","lineNumber":124,"sourceCode":"    } catch {\n      enqueueErrorSnackBar({ message: errorMsgUserAlreadyExist });\n    }\n  }, [\n    readCaptchaToken,\n    form,\n    isCaptchaReady,\n    enqueueErrorSnackBar,\n    t,\n    checkUserExistsQuery,\n    setSignInUpMode,\n    setSignInUpStep,\n    errorMsgUserAlreadyExist,\n  ]);\n\n  const submitCredentials: SubmitHandler<Form> = useCallback(\n    async (data) => {\n      if (!data.email || !data.password) {\n        throw new Error('Email and password are required');\n      }\n\n      if (!isCaptchaReady) {\n        return enqueueErrorSnackBar({\n          message: t`Captcha (anti-bot check) is still loading, try again`,\n        });\n      }\n\n      const token = readCaptchaToken();\n      try {\n        setLastAuthenticatedMethod(AuthenticatedMethod.EMAIL);\n\n        if (\n          !isInviteMode &&\n          signInUpMode === SignInUpMode.SignIn &&\n          isOnAWorkspace\n        ) {\n          return await signInWithCredentialsInWorkspace(","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts#L106-L142","documentation":"Thrown by useSignInUp's submitCredentials callback (useSignInUp.ts:123-125) when the submitted form values do not include both an email and a password. This is a defensive guard at the top of the sign-in submit handler before captcha/auth logic runs. Because it is thrown inside a React callback, it surfaces as an uncaught promise rejection unless the form library (react-hook-form) captures it.","triggerScenarios":"The sign-in form is submitted with an empty email or password field. Normally react-hook-form's required validators prevent this, so reaching the throw indicates validation was bypassed or disabled.","commonSituations":"Custom UI that calls submitCredentials directly without going through react-hook-form validation; a validator removed or made optional; programmatic submit with partial data; race where the form resets before submit fires.","solutions":["Keep `required: true` (or equivalent) on the email and password field validators in react-hook-form.","If invoking submitCredentials manually, pre-check `data.email && data.password` before calling.","Render disabled submit button until both fields are non-empty.","Test the form with empty inputs to confirm validation blocks submission."],"exampleFix":"// before\nconst { register, handleSubmit } = useForm<Form>();\n<input {...register('email')} />\n// after\n<input {...register('email', { required: true })} />\n<input {...register('password', { required: true })} />","handlingStrategy":"validation","validationCode":"// In the component, ensure react-hook-form marks both fields required\nconst { register, handleSubmit } = useForm<Form>({\n  defaultValues: { email: '', password: '' },\n});\n<input {...register('email', { required: true })} />\n<input {...register('password', { required: true })} />","typeGuard":"const hasEmailAndPassword = (data: Partial<Form>): data is { email: string; password: string } =>\n  typeof data.email === 'string' && data.email.length > 0 &&\n  typeof data.password === 'string' && data.password.length > 0;","tryCatchPattern":null,"preventionTips":["Use required validators on email and password fields.","Disable the submit button until both fields are non-empty.","Avoid invoking submitCredentials outside react-hook-form's handleSubmit.","Reset handlers when the form unmounts to avoid stale submits."],"tags":["frontend","auth","react-hook-form","validation"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}