toeverything/AFFiNE · error · InvalidEmail

invalid_email

invalid_email

Error message

An invalid email provided: not provided

What it means

Sentinel message produced by the auth preflight validation when the submitted email field fails validation — the schema parse or email validator reports an invalid address, and 'not provided' is the placeholder when no email was sent at all. The request is rejected with an invalid-argument style error before any account lookup happens.

Solutions

  1. Provide an email address in the request body — the sign-in/sign-up call was made with an empty or missing email field.
  2. Validate the email client-side (non-empty, RFC format) before submitting to avoid this round trip.

Example fix

if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
  setError('Please enter a valid email');
  return;
}
await signIn({ email });
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/backend/server/src/core/auth/controller.ts:97 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of toeverything/AFFiNE@2af30773ae (2026-08-18). Data as JSON: /api/errors/a6f2871eeb80bda0. Report an issue: GitHub.

Appendix: source

Thrown at packages/backend/server/src/core/auth/controller.ts:92

    private readonly authSessions: AuthSessionService
  ) {
    if (env.dev) {
      // set DNS servers in dev mode
      // NOTE: some network debugging software uses DNS hijacking
      // to better debug traffic, but their DNS servers may not
      // handle the non dns query(like txt, mx) correctly, so we
      // set a public DNS server here to avoid this issue.
      setServers(['1.1.1.1', '8.8.8.8']);
    }
  }

  @Public()
  @UseNamedGuard('version')
  @Post('/preflight')
  async preflight(@Body() body?: unknown): Promise<PreflightResponse> {
    const input = AuthPreflightBodySchema.safeParse(body);
    if (!input.success) {
      throw new InvalidEmail({ email: 'not provided' });
    }
    validators.assertValidEmail(input.data.email);

    try {
      return await this.runtime.executeAuthSessionCommandV1<PreflightResponse>({
        action: 'login_preflight',
        email: input.data.email,
      });
    } catch (error) {
      if (String(error).includes('email_domain_verification_unavailable')) {
        throw new NetworkError();
      }
      throw error;
    }
  }

  @UseNamedGuard('version')
  @Get('/methods')

View on GitHub (pinned to 2af30773ae)