Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot execute method GetMyName #1474

Open
SpCoGov opened this issue Jan 8, 2025 · 1 comment
Open

Cannot execute method GetMyName #1474

SpCoGov opened this issue Jan 8, 2025 · 1 comment

Comments

@SpCoGov
Copy link

SpCoGov commented Jan 8, 2025

Describe the bug
When executing the GetMyName method, an exception is thrown: "Exception in thread "main" java.lang.RuntimeException: Unable to deserialize response"

To Reproduce
Steps to reproduce the behavior:

TelegramClient telegramClient = new OkHttpTelegramClient(botToken);
GetMyName getMyName = GetMyName.builder()
                    .build();
telegramClient.execute(getMyName)
  1. Run the code
  2. See error

Expected behavior
Return BotName

Desktop (please complete the following information):

  • macOS
  • Browser Chrome
  • Version 15.3 Beta(24D5034f)

Additional context
The full stack trace is as follows:

Exception in thread "main" java.lang.RuntimeException: Unable to deserialize response
	at com.example.telegram.Telegram.<init>(Telegram.java:62)
	at com.example.telegram.Telegram.getInstance(Telegram.java:71)
	at com.example.Main.main(Main.java:27)
Caused by: 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.deserializeResponse(PartialBotApiMethod.java:43)
	at org.telegram.telegrambots.meta.api.methods.name.GetMyName.deserializeResponse(GetMyName.java:43)
	at org.telegram.telegrambots.meta.api.methods.name.GetMyName.deserializeResponse(GetMyName.java:22)
Caused by: Unable to deserialize response

	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:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.telegram.telegrambots.meta.api.objects.name.BotName` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 22] (through reference chain: org.telegram.telegrambots.meta.api.objects.ApiResponse["result"])
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.telegram.telegrambots.meta.api.objects.name.BotName` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)

	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
	at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1754)
	at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1379)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1508)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:348)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
	at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4905)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3848)
	at org.telegram.telegrambots.meta.api.methods.botapimethods.PartialBotApiMethod.deserializeResponseInternal(PartialBotApiMethod.java:59)
	... 8 more
@aNNiMON
Copy link
Contributor

aNNiMON commented Jan 8, 2025

@SpCoGov thanks. Same problem for GetMyDescription and GetMyShortDescription.
For now you can use getMe as a workaround:

String firstName = telegramClient.execute(new GetMe()).getFirstName();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants