{"record":{"id":"30bfe2d8cab74531","repo":"hcengineering/platform","slug":"account-does-not-exist","errorCode":null,"errorMessage":"Account does not exist","messagePattern":"Account does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"services/telegram/pod-telegram/src/telegram.ts","lineNumber":56,"sourceCode":"    return this._state\n  }\n\n  async code (code: string): Promise<boolean> {\n    if (this._state !== 'code') {\n      throw Error('Invalid sign in method')\n    }\n\n    try {\n      const res = await this.client.invoke(\n        new Api.auth.SignIn({\n          phoneNumber: this.phone,\n          phoneCodeHash: this.codeHash,\n          phoneCode: code\n        })\n      )\n\n      if (res instanceof Api.auth.AuthorizationSignUpRequired) {\n        throw Error('Account does not exist')\n      }\n\n      this.finish()\n      return true\n    } catch (err: unknown) {\n      if (err instanceof RPCError) {\n        const untypedErr: any = err\n        if (untypedErr.errorMessage === 'SESSION_PASSWORD_NEEDED') {\n          this._state = 'pass'\n          return false\n        }\n\n        if (untypedErr.errorMessage === 'PHONE_CODE_INVALID') {\n          throw new ApiError(Code.PhoneCodeInvalid, err.message)\n        }\n      }\n\n      throw err","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/telegram/pod-telegram/src/telegram.ts#L38-L74","documentation":"After submitting the code, Telegram returns AuthorizationSignUpRequired when the phone number has no existing account. Since this integration only supports signing into existing accounts, it throws 'Account does not exist'.","triggerScenarios":"authCode()/code() called with a valid code for a phone number that was never registered with Telegram, so Telegram responds with Api.auth.AuthorizationSignUpRequired.","commonSituations":"User enters a brand-new phone number never used with Telegram; typos in phone number pointing at an unregistered number; test numbers without accounts.","solutions":["Verify the phone number actually has a Telegram account before starting sign-in","Tell the user to register the number with Telegram first, then retry","Correct a mistyped phone number and restart the sign-in flow","If sign-up support is desired, handle AuthorizationSignUpRequired explicitly instead of throwing"],"exampleFix":"// before\nconst ok = await flow.code(code) // throws when account missing\n// after\ntry {\n  const ok = await flow.code(code)\n} catch (err) {\n  if (err.message === 'Account does not exist') {\n    show('This phone number has no Telegram account. Please register it first.')\n  }\n}","handlingStrategy":"try-catch","validationCode":"// pre-check: confirm the phone is associated with a Telegram account before starting sign-in\nconst exists = await accountExists(phone) // external check\nif (!exists) show('This number has no Telegram account')","typeGuard":null,"tryCatchPattern":"try {\n  await flow.code(code)\n} catch (err) {\n  if (err.message === 'Account does not exist') {\n    show('No Telegram account for this number. Please register first.')\n  } else {\n    throw err\n  }\n}","preventionTips":["Validate phone number format (E.164) before sign-in","Tell users the account must already exist on Telegram","Distinguish this error from wrong-code errors in the UI"],"tags":["telegram","auth","account"],"backgroundTag":"account-not-registered","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}