LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!

Home Page:https://docs.telethon.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New RPC error: IMPORT_PEER_TYPE_INVALID

tim-ufer opened this issue · comments

Description

Hello, I believe I have run into an undocumented RPC error while working on an API tool that would let users reimport Telegram's chat exports back into itself. To do this, I was using the foreign chat import procedure and when calling InitHistoryImportRequest, I get the following error:

telethon.errors.rpcbaseerrors.BadRequestError: RPCError 400: IMPORT_PEER_TYPE_INVALID (caused by InitHistoryImportRequest)

This specific BadRequestError is not listed in the relevant Telegram API docs, Telethon TL docs or the list of known errors spreadsheet.

I suspect that the error is caused by the chat export file being flagged as pm and the target peer being a group chat. Unfortunately, I haven't yet found a workaround for the issue so I'd welcome anyone's guess on the exact source of the error or how to get around it while importing.

Checklist

  • This is a documentation problem, not a question or a bug report.
  • I have searched for this issue before posting it and there isn't a duplicate.

Thanks for the detailed report. I've stopped bothering updating the errors.csv file but you're welcome to send a PR.

As for workaround or guesses, I don't have any, but I can suggest using Telegram Desktop with debugmode enable, perform the action, then check the mtp log to see how it does it.