Telethon icon indicating copy to clipboard operation
Telethon copied to clipboard

New RPC error: IMPORT_PEER_TYPE_INVALID

Open tim-ufer opened this issue 1 year ago • 1 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

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

tim-ufer avatar Mar 14 '24 23:03 tim-ufer

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.

Lonami avatar Mar 15 '24 07:03 Lonami