{"record":{"id":"cb7171f60664d20f","repo":"HeyPuter/puter","slug":"account-is-not-verified","errorCode":"account_is_not_verified","errorMessage":"Account email is not verified","messagePattern":"Account email is not verified","errorType":"exception","errorClass":"HttpError","httpStatus":403,"severity":"error","filePath":"src/backend/core/http/verifiedEmail.ts","lineNumber":37,"sourceCode":"\nimport { HttpError } from './HttpError.js';\n\ntype EmailVerifiedUser =\n    | {\n          email_confirmed?: unknown;\n      }\n    | null\n    | undefined;\n\nexport const assertVerifiedEmail = (\n    strictFlag: boolean,\n    user: EmailVerifiedUser,\n    statusCode = 403,\n): void => {\n    if (!strictFlag) return;\n    if (user?.email_confirmed) return;\n\n    throw new HttpError(statusCode, 'Account email is not verified', {\n        legacyCode: 'account_is_not_verified',\n    });\n};\n","sourceCodeStart":19,"sourceCodeEnd":41,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/core/http/verifiedEmail.ts#L19-L41","documentation":"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).","triggerScenarios":"A handler explicitly calls `assertVerifiedEmail(true, user)` (or a route opts into strict email verification) while the caller's email is unconfirmed.","commonSituations":"A feature route tightened to require verified email; a user who registered but never confirmed; `email_confirmed` reset after an email change.","solutions":["Confirm the account's email address.","Resend the confirmation email if needed.","If the route does not truly require it, pass `strictFlag=false` (or the status code / gate) when calling assertVerifiedEmail."],"exampleFix":"// before\nassertVerifiedEmail(true, user);\n// after (route that does not require it)\nassertVerifiedEmail(false, user);","handlingStrategy":"validation","validationCode":"// Gate strict routes client-side when you know the user's email state:\nif (strict && !(user && user.email_confirmed)) { promptEmailConfirmation(); return; }","typeGuard":"const hasVerifiedEmail = (u) => !!(u && u.email_confirmed);","tryCatchPattern":"try { await call(); }\ncatch (e) {\n  if (e.code === 'account_is_not_verified') { resendConfirmation(); return; }\n  throw e;\n}","preventionTips":["Confirm email before reaching strict-verification routes.","Resend the confirmation link if it may have expired.","Only opt a route into strict email verification when genuinely required."],"tags":["email","verification","gate","strict"],"backgroundTag":null,"analyzedSha":"908ec23eda38526170322c3edf71ba45ecb1ca95","analyzedAt":"2026-08-12T20:53:15.911Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}