HeyPuter/puter · error · HttpError

account_is_not_verified

account_is_not_verified

Error message

Account email is not verified

What it means

Raised by `assertVerifiedEmail(strictFlag, user)`: the route passed `strictFlag=true` (it requires a verified email) and the user's `email_confirmed` is falsy. This is a per-route strict gate, distinct from the account-level `requires_email_confirmation` flag in `assertVerifiedAccount`. The status code is configurable (default 403).

Solutions

  1. Confirm the account's email address.
  2. Resend the confirmation email if needed.
  3. If the route does not truly require it, pass `strictFlag=false` (or the status code / gate) when calling assertVerifiedEmail.

Example fix

// before
assertVerifiedEmail(true, user);
// after (route that does not require it)
assertVerifiedEmail(false, user);
Defensive patterns

Strategy: validation

Validate before calling

// Gate strict routes client-side when you know the user's email state:
if (strict && !(user && user.email_confirmed)) { promptEmailConfirmation(); return; }

Type guard

const hasVerifiedEmail = (u) => !!(u && u.email_confirmed);

Try / catch

try { await call(); }
catch (e) {
  if (e.code === 'account_is_not_verified') { resendConfirmation(); return; }
  throw e;
}

Prevention

When it happens

Trigger: A handler explicitly calls `assertVerifiedEmail(true, user)` (or a route opts into strict email verification) while the caller's email is unconfirmed.

Common situations: A feature route tightened to require verified email; a user who registered but never confirmed; `email_confirmed` reset after an email change.

Related errors


AI-assisted analysis of HeyPuter/puter@908ec23eda (2026-08-12). Data as JSON: /api/errors/cb7171f60664d20f. Report an issue: GitHub.

Appendix: source

Thrown at src/backend/core/http/verifiedEmail.ts:37

import { HttpError } from './HttpError.js';

type EmailVerifiedUser =
    | {
          email_confirmed?: unknown;
      }
    | null
    | undefined;

export const assertVerifiedEmail = (
    strictFlag: boolean,
    user: EmailVerifiedUser,
    statusCode = 403,
): void => {
    if (!strictFlag) return;
    if (user?.email_confirmed) return;

    throw new HttpError(statusCode, 'Account email is not verified', {
        legacyCode: 'account_is_not_verified',
    });
};

View on GitHub (pinned to 908ec23eda)