Skip to content

sendMediaGroup Unable to deserialize response Could not resolve type id '0' as a subtype of StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION #1510

@CoderOrdinary

Description

@CoderOrdinary

Hi,
I'm experiencing an intermittent issue when using the sendMediaGroup method with the following environment:

  • JDK version: 21
  • telegrambots version: 8.3

Occasionally, when calling sendMediaGroup, the following exception is thrown:

org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Unable to deserialize response
    at org.telegram.telegrambots.meta.api.methods.botapimethods.PartialBotApiMethod.deserializeResponseInternal(PartialBotApiMethod.java:66)
    at org.telegram.telegrambots.meta.api.methods.botapimethods.PartialBotApiMethod.deserializeResponseArray(PartialBotApiMethod.java:48)
    at org.telegram.telegrambots.meta.api.methods.send.SendMediaGroup.deserializeResponse(SendMediaGroup.java:146)
    at org.telegram.telegrambots.meta.api.methods.send.SendMediaGroup.deserializeResponse(SendMediaGroup.java:39)
    at org.telegram.telegrambots.client.okhttp.OkHttpFutureCallback.onResponse(OkHttpFutureCallback.java:35)
    at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id '0' as a subtype of `org.telegram.telegrambots.meta.api.objects.message.Message`: Class `org.telegram.telegrambots.meta.api.objects.message.InaccessibleMessage` not subtype of `org.telegram.telegrambots.meta.api.objects.message.Message`
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 302] (through reference chain: org.telegram.telegrambots.meta.api.objects.ApiResponse["result"]->java.util.ArrayList[0])
    at com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43)

This error does not occur every time, but happens sporadically.
From the stack trace, it seems to be related to deserialization of the response from the Telegram server, possibly when the response contains an InaccessibleMessage object, which is not a subtype of Message.
Has anyone else encountered this issue? Is there a recommended workaround or fix for this problem?
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions