hcengineering/platform · error · Error

Account does not exist

Error message

Account does not exist

What it means

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'.

Source

Thrown at services/telegram/pod-telegram/src/telegram.ts:56

    return this._state
  }

  async code (code: string): Promise<boolean> {
    if (this._state !== 'code') {
      throw Error('Invalid sign in method')
    }

    try {
      const res = await this.client.invoke(
        new Api.auth.SignIn({
          phoneNumber: this.phone,
          phoneCodeHash: this.codeHash,
          phoneCode: code
        })
      )

      if (res instanceof Api.auth.AuthorizationSignUpRequired) {
        throw Error('Account does not exist')
      }

      this.finish()
      return true
    } catch (err: unknown) {
      if (err instanceof RPCError) {
        const untypedErr: any = err
        if (untypedErr.errorMessage === 'SESSION_PASSWORD_NEEDED') {
          this._state = 'pass'
          return false
        }

        if (untypedErr.errorMessage === 'PHONE_CODE_INVALID') {
          throw new ApiError(Code.PhoneCodeInvalid, err.message)
        }
      }

      throw err

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Verify the phone number actually has a Telegram account before starting sign-in
  2. Tell the user to register the number with Telegram first, then retry
  3. Correct a mistyped phone number and restart the sign-in flow
  4. If sign-up support is desired, handle AuthorizationSignUpRequired explicitly instead of throwing

Example fix

// before
const ok = await flow.code(code) // throws when account missing
// after
try {
  const ok = await flow.code(code)
} catch (err) {
  if (err.message === 'Account does not exist') {
    show('This phone number has no Telegram account. Please register it first.')
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check: confirm the phone is associated with a Telegram account before starting sign-in
const exists = await accountExists(phone) // external check
if (!exists) show('This number has no Telegram account')

Try / catch

try {
  await flow.code(code)
} catch (err) {
  if (err.message === 'Account does not exist') {
    show('No Telegram account for this number. Please register first.')
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: authCode()/code() called with a valid code for a phone number that was never registered with Telegram, so Telegram responds with Api.auth.AuthorizationSignUpRequired.

Common situations: User enters a brand-new phone number never used with Telegram; typos in phone number pointing at an unregistered number; test numbers without accounts.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/30bfe2d8cab74531. Report an issue: GitHub.