Cobalt icon indicating copy to clipboard operation
Cobalt copied to clipboard

Message decryption errors

Open ZiemlichUndead opened this issue 3 years ago • 18 comments

Hey, I got this error lately. It did not interrupt anything or cause further problems. Seems to me like some sort of service message from Whatsapp itself or sth. I do not recognize the phone number the message is from (still cencored cause you never know)

Seems like a minor bug but still wanted to inform you in case you havent seen this yet.

Jul 28, 2022 12:13:04 PM it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1 SEVERE: Socket failure at MESSAGE java.lang.RuntimeException: Cannot decrypt message with type skmsg inside status@broadcast from 4917817****@s.whatsapp.net at it.auties.whatsapp.socket.MessageHandler.decodeMessageBytes(MessageHandler.java:503) at it.auties.whatsapp.socket.MessageHandler.decode(MessageHandler.java:432) at it.auties.whatsapp.socket.MessageHandler.lambda$decode$36(MessageHandler.java:380) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at it.auties.whatsapp.socket.MessageHandler.decode(MessageHandler.java:380) at it.auties.whatsapp.socket.Socket.readMessage(Socket.java:314) at it.auties.whatsapp.socket.StreamHandler.digest(StreamHandler.java:64) at it.auties.whatsapp.socket.Socket.handleNode(Socket.java:192) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at it.auties.whatsapp.socket.Socket.onBinary(Socket.java:187) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(AnnotatedEndpoint.java:553) at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(AnnotatedEndpoint.java:652) at org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(TyrusSession.java:560) at org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(TyrusEndpointWrapper.java:800) at org.glassfish.tyrus.core.TyrusWebSocket.onMessage(TyrusWebSocket.java:183) at org.glassfish.tyrus.core.frame.BinaryFrame.respond(BinaryFrame.java:70) at org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:819) at org.glassfish.tyrus.client.TyrusClientEngine$TyrusReadHandler.handle(TyrusClientEngine.java:725) at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter$ProcessTask.execute(GrizzlyClientFilter.java:452) at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:91) at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:68) at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(GrizzlyClientFilter.java:248) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:34) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.util.NoSuchElementException: Cannot find state with id 1712577466 at it.auties.whatsapp.model.signal.sender.SenderKeyRecord.lambda$findStateById$1(SenderKeyRecord.java:43) at java.base/java.util.Optional.orElseThrow(Optional.java:403) at it.auties.whatsapp.model.signal.sender.SenderKeyRecord.findStateById(SenderKeyRecord.java:43) at it.auties.whatsapp.crypto.GroupCipher.decrypt(GroupCipher.java:38) at it.auties.whatsapp.socket.MessageHandler.decodeMessageBytes(MessageHandler.java:472) ... 39 more

ZiemlichUndead avatar Jul 28 '22 12:07 ZiemlichUndead

Seems like a minor bug but still wanted to inform you in case you havent seen this yet

Does it happen for all broadcast messages that you receive? I have never tried to be honest

Auties00 avatar Jul 28 '22 18:07 Auties00

To be honest myself i didnt even know broadcasts existed. And I dont think my account was part of any broadcasts while this happened. I now created broadcasts to test it does not seem like there is any issue with them. Neither when I send a message from this account into a broadcast nor when the account receives messages sent from a broadcast.

In fact I dont think I even received any messages at the time this error occurred.

I did reset my Whatsapp Web session now and will monitor if I get this error again.

ZiemlichUndead avatar Jul 28 '22 20:07 ZiemlichUndead

To be honest myself i didnt even know broadcasts existed. And I dont think my account was part of any broadcasts while this happened. I now created broadcasts to test it does not seem like there is any issue with them. Neither when I send a message from this account into a broadcast nor when the account receives messages sent from a broadcast.

In fact I dont think I even received any messages at the time this error occurred.

I did reset my Whatsapp Web session now and will monitor if I get this error again.

The problem is that if someone sends you a broadcast message you can't tell that it's coming from a broadcast list. It should come up every time you create a new session with that account I would guess

Auties00 avatar Jul 28 '22 21:07 Auties00

To be honest myself i didnt even know broadcasts existed. And I dont think my account was part of any broadcasts while this happened. I now created broadcasts to test it does not seem like there is any issue with them. Neither when I send a message from this account into a broadcast nor when the account receives messages sent from a broadcast. In fact I dont think I even received any messages at the time this error occurred. I did reset my Whatsapp Web session now and will monitor if I get this error again.

The problem is that if someone sends you a broadcast message you can't tell that it's coming from a broadcast list. It should come up every time you create a new session with that account I would guess

Okay so it definitely does not happen everytime i create a session. And i can kinda tell that i did not receive broadcasts because i registered this account with a new number just for the purpose of testing the API. There are only 3 people that have this number and they helped me debug. I am very sure none of them sent a broadcast to the account. I can ask them but that would not make any sense to me.

ZiemlichUndead avatar Jul 28 '22 21:07 ZiemlichUndead

To be honest myself i didnt even know broadcasts existed. And I dont think my account was part of any broadcasts while this happened. I now created broadcasts to test it does not seem like there is any issue with them. Neither when I send a message from this account into a broadcast nor when the account receives messages sent from a broadcast. In fact I dont think I even received any messages at the time this error occurred. I did reset my Whatsapp Web session now and will monitor if I get this error again.

The problem is that if someone sends you a broadcast message you can't tell that it's coming from a broadcast list. It should come up every time you create a new session with that account I would guess

Okay so it definitely does not happen everytime i create a session. And i can kinda tell that i did not receive broadcasts because i registered this account with a new number just for the purpose of testing the API. There are only 3 people that have this number and they helped me debug. I am very sure none of them sent a broadcast to the account. I can ask them but that would not make any sense to me.

Maybe it's the psa get you get from Whatsapp when you first join?

Auties00 avatar Jul 28 '22 22:07 Auties00

Never seen such a message so not sure but it would make sense i guess.

Issue has not happend again yet btw

ZiemlichUndead avatar Jul 29 '22 15:07 ZiemlichUndead

Ok so i did get the exception again now. This time it got thrown 4 times in one second and the phone number it is coming from is different. Could this be something like the "update your whatsapp web" notification you get when using regular whatsapp web?

And can i do something to get more info on what exactly is received? Like add some debug output to a method or something? Or look for something in the chat database?

ZiemlichUndead avatar Aug 02 '22 12:08 ZiemlichUndead

New theory here. I just found out that the phone number that sends those messages is a real number owned by a real person. I can also see that this person has my number saved as a contact because i can see his profile and status with this account but not with my private account.

So maybe this account tried to send a broadcast to me but cause i do not have him as a contact the message did not get through and caused this error? I tried to reproduce this with my account but there the message just did not get delivered and caused no error.

I added that contact now. Maybe i will see what exactly he sends to me. I could alternatively try to do something with the encodedMessage but not sure if I'm able to do anything with it.

ZiemlichUndead avatar Aug 02 '22 19:08 ZiemlichUndead

New theory here. I just found out that the phone number that sends those messages is a real number owned by a real person. I can also see that this person has my number saved as a contact because i can see his profile and status with this account but not with my private account.

So maybe this account tried to send a broadcast to me but cause i do not have him as a contact the message did not get through and caused this error? I tried to reproduce this with my account but there the message just did not get delivered and caused no error.

I added that contact now. Maybe i will see what exactly he sends to me. I could alternatively try to do something with the encodedMessage but not sure if I'm able to do anything with it.

That message is e2e encrypted, without the right keys(which you don't have if your theory is correct) there is nothing to do. Another possibility is that it's not a broadcast message and there is some error before

Auties00 avatar Aug 02 '22 20:08 Auties00

New theory here. I just found out that the phone number that sends those messages is a real number owned by a real person. I can also see that this person has my number saved as a contact because i can see his profile and status with this account but not with my private account. So maybe this account tried to send a broadcast to me but cause i do not have him as a contact the message did not get through and caused this error? I tried to reproduce this with my account but there the message just did not get delivered and caused no error. I added that contact now. Maybe i will see what exactly he sends to me. I could alternatively try to do something with the encodedMessage but not sure if I'm able to do anything with it.

That message is e2e encrypted, without the right keys(which you don't have if your theory is correct) there is nothing to do. Another possibility is that it's not a broadcast message and there is some error before

Okay i finally found out what the messages are. They are just those Whatsapp Status "Stories" you can post. I can replicate the error by creating such a status story (Image) with my private account and sharing it with the account W4J is running on. If you tell me how to help I could do further tests for you or something.

Additionaly, I have no idea why I got the error while not having the number saved as a contact. When I do the same with my private number I just dont receive anything, no error. Seems like a Whatsapp bug to me to be honest.

ZiemlichUndead avatar Aug 03 '22 13:08 ZiemlichUndead

New theory here. I just found out that the phone number that sends those messages is a real number owned by a real person. I can also see that this person has my number saved as a contact because i can see his profile and status with this account but not with my private account. So maybe this account tried to send a broadcast to me but cause i do not have him as a contact the message did not get through and caused this error? I tried to reproduce this with my account but there the message just did not get delivered and caused no error. I added that contact now. Maybe i will see what exactly he sends to me. I could alternatively try to do something with the encodedMessage but not sure if I'm able to do anything with it.

That message is e2e encrypted, without the right keys(which you don't have if your theory is correct) there is nothing to do. Another possibility is that it's not a broadcast message and there is some error before

Okay i finally found out what the messages are. They are just those Whatsapp Status "Stories" you can post. I can replicate the error by creating such a status story (Image) with my private account and sharing it with the account W4J is running on. If you tell me how to help I could do further tests for you or something.

Additionaly, I have no idea why I got the error while not having the number saved as a contact. When I do the same with my private number I just dont receive anything, no error. Seems like a Whatsapp bug to me to be honest.

Oh well makes sense, I'll try to fix it asap

Auties00 avatar Aug 04 '22 13:08 Auties00

+1

ssouza avatar Sep 01 '22 13:09 ssouza

@ssouza @ZiemlichUndead test RC19 and lmk

Auties00 avatar Sep 01 '22 16:09 Auties00

Hi @Auties00, I´m sending messages to phone numbers that I do not have registered in my whatsapp account. Whatsappweb4j sends the messages and it is received by the other accoount, but over time I start to get Exceptions:

sept 07, 2022 8:28:28 P.áM. it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1 GRAVE: Socket failure at MESSAGE java.lang.RuntimeException: Cannot decrypt message with type msg inside [email protected] from [email protected] at it.auties.whatsapp.socket.MessageHandler.decodeMessageBytes(MessageHandler.java:503) at it.auties.whatsapp.socket.MessageHandler.decode(MessageHandler.java:432) at it.auties.whatsapp.socket.MessageHandler.lambda$decode$36(MessageHandler.java:380) at java.base/java.lang.Iterable.forEach(Unknown Source) at it.auties.whatsapp.socket.MessageHandler.decode(MessageHandler.java:380) at it.auties.whatsapp.socket.Socket.readMessage(Socket.java:314) at it.auties.whatsapp.socket.StreamHandler.digest(StreamHandler.java:64) at it.auties.whatsapp.socket.Socket.handleNode(Socket.java:192) at java.base/java.lang.Iterable.forEach(Unknown Source) at it.auties.whatsapp.socket.Socket.onBinary(Socket.java:187) at jdk.internal.reflect.GeneratedMethodAccessor154.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(AnnotatedEndpoint.java:553) at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(AnnotatedEndpoint.java:652) at org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(TyrusSession.java:560) at org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(TyrusEndpointWrapper.java:800) at org.glassfish.tyrus.core.TyrusWebSocket.onMessage(TyrusWebSocket.java:183) at org.glassfish.tyrus.core.frame.BinaryFrame.respond(BinaryFrame.java:70) at org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:819) at org.glassfish.tyrus.client.TyrusClientEngine$TyrusReadHandler.handle(TyrusClientEngine.java:725) at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter$ProcessTask.execute(GrizzlyClientFilter.java:452) at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:91) at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:68) at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(GrizzlyClientFilter.java:248) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.util.NoSuchElementException: Cannot decrypt message: no suitable session found at it.auties.whatsapp.crypto.SessionCipher.lambda$decrypt$5(SessionCipher.java:137) at java.base/java.util.Optional.orElseThrow(Unknown Source) at it.auties.whatsapp.crypto.SessionCipher.decrypt(SessionCipher.java:137) at it.auties.whatsapp.socket.MessageHandler.decodeMessageBytes(MessageHandler.java:495) ... 37 more sept 07, 2022 8:28:28 P.áM. it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1 GRAVE: Ignored failure

The code I´m using to send the message is the following:

private void enviarMensajeWhatsapp(String telefono, String mensaje) { conexion.sendMessage(crearNuevoChat(anadirContacto(telefono), "Chat"), mensaje).join(); }

private Contact anadirContacto(String telefono) { Contact nuevoContacto = new Contact(new ContactJid(telefono, ContactJid.Server.WHATSAPP,1,1),"","","", ContactStatus.AVAILABLE, ZonedDateTime.now()); return nuevoContacto; }

private Chat crearNuevoChat(Contact nuevoContacto, String nombreChat) { Chat nuevaConversacion = new Chat(nuevoContacto.jid(), new SortedMessageList(), nuevoContacto.jid(), nuevoContacto.jid(), 1, ChatEphemeralTimer.THREE_MONTHS, 1, 1, nombreChat, true, true, new ChatDisappear(ChatDisappear.Type.INITIATED_BY_ME), new byte[0], 1, new byte[0], 1, new ChatMute(1), null, ChatMediaVisibility.DEFAULT, 1, true, null, null); return nuevaConversacion; }

To be honest, I do not really know what all these parameters do. I filled them out the best way I could and to achive sendMessage method to work ok.

I would appreciate any help that can guide me building the ContactJid and Chat objects in order to avoid WhatsappWeb4j from throwing Exceptions.

Thanks!!

CristianAde avatar Sep 08 '22 08:09 CristianAde

Looks like there are still some errors when using the API after some hours. I'll look into fixing them before a stable release.

Auties00 avatar Sep 18 '22 21:09 Auties00

I'm going to guess that it's because I never implemented message retries, maybe that's why

Auties00 avatar Sep 19 '22 15:09 Auties00

I´m now working with RC26, thanks for the update @Auties00. I adapted my sendMessage methods (enviarMensajeWhatsapp) to the new features and it seems, allthough I still get some aislated decrypt message exceptions, that it´s working much better. I´ll keep testing and updating

CristianAde avatar Sep 22 '22 08:09 CristianAde

Looks like it's pretty much fixed, unless your sessions stays not active for a long time and then you reconnect. I'll have this fixed also before a stable release

Auties00 avatar Sep 30 '22 19:09 Auties00

@Auties00 Just to give you an indication (if you haven't already)

The decryption errors occured every time when a disconnect / reconnect happens:

2022-10-21 17:27:02,770 | DEBUG | pool-3-thread-1 | com.mypackage.WhatsappListener | [Whats App] Disconnect (whatsapp, reason)
2022-10-21 17:27:02,770 | DEBUG | pool-3-thread-1 | com.mypackage.WhatsappListener | [Whats App] Disconnect reason: 'RECONNECTING'
2022-10-21 17:27:02,770 | DEBUG | pool-3-thread-1 | com.mypackage.WhatsappListener | [Whats App] Disconnect (reason)
2022-10-21 17:27:02,770 | DEBUG | pool-3-thread-1 | com.mypackage.WhatsappListener | [Whats App] Disconnect reason: 'RECONNECTING'
2022-10-21 17:27:03,433 | DEBUG | pool-3-thread-1 | com.mypackage.WhatsappListener | [Whats App] Logged In
2022-10-21 17:27:03,736 | ERROR | Grizzly(1) | it.auties.whatsapp.api.ErrorHandler | Socket failure at MESSAGE
2022-10-21 17:27:03,736 | ERROR | Grizzly(1) | com.mypackage.service.WhatsAppService | WhatsApp Error: 'Cannot decrypt message with type msg inside [email protected] from [email protected]'
2022-10-21 17:27:03,736 | ERROR | Grizzly(1) | com.mypackage.service.WhatsAppService | Stacktrace: 
java.lang.RuntimeException: Cannot decrypt message with type msg inside [email protected] from [email protected]
	at it.auties.whatsapp.socket.MessageHandler.decodeMessageBytes(MessageHandler.java:487)
	at it.auties.whatsapp.socket.MessageHandler.decode(MessageHandler.java:416)
	at it.auties.whatsapp.socket.MessageHandler.lambda$decode$36(MessageHandler.java:370)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at it.auties.whatsapp.socket.MessageHandler.decode(MessageHandler.java:370)
	at it.auties.whatsapp.socket.Socket.readMessage(Socket.java:296)
	at it.auties.whatsapp.socket.StreamHandler.digest(StreamHandler.java:65)
	at it.auties.whatsapp.socket.Socket.handleNode(Socket.java:186)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at it.auties.whatsapp.socket.Socket.onBinary(Socket.java:181)
	at jdk.internal.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(AnnotatedEndpoint.java:556)
	at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(AnnotatedEndpoint.java:655)
	at org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(TyrusSession.java:591)
	at org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(TyrusEndpointWrapper.java:806)
	at org.glassfish.tyrus.core.TyrusWebSocket.onMessage(TyrusWebSocket.java:183)
	at org.glassfish.tyrus.core.frame.BinaryFrame.respond(BinaryFrame.java:70)
	at org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:819)
	at org.glassfish.tyrus.client.TyrusClientEngine$TyrusReadHandler.handle(TyrusClientEngine.java:726)
	at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter$ProcessTask.execute(GrizzlyClientFilter.java:452)
	at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:91)
	at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(TaskProcessor.java:68)
	at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(GrizzlyClientFilter.java:248)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.util.NoSuchElementException: Cannot decrypt message: no suitable session found
	at it.auties.whatsapp.crypto.SessionCipher.lambda$decrypt$5(SessionCipher.java:137)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at it.auties.whatsapp.crypto.SessionCipher.decrypt(SessionCipher.java:137)
	at it.auties.whatsapp.socket.MessageHandler.decodeMessageBytes(MessageHandler.java:479)
	... 37 common frames omitted
2022-10-21 17:27:03,737 | ERROR | Grizzly(1) | it.auties.whatsapp.api.ErrorHandler | Ignored failure
2022-10-21 17:27:03,737 | ERROR | Grizzly(1) | it.auties.whatsapp.api.ErrorHandler | Socket failure at MESSAGE
2022-10-21 17:27:03,737 | ERROR | Grizzly(1) | com.mypackage.service.WhatsAppService | WhatsApp Error: 'Cannot decrypt message with type msg inside [email protected] from [email protected]'
2022-10-21 17:27:03,737 | ERROR | Grizzly(1) | com.mypackage.service.WhatsAppService | Stacktrace: 
java.lang.RuntimeException: Cannot decrypt message with type msg inside [email protected] from [email protected]
	at it.auties.whatsapp.socket.MessageHandler.decodeMessageBytes(MessageHandler.java:487)
	at it.auties.whatsapp.socket.MessageHandler.decode(MessageHandler.java:416)
	at it.auties.whatsapp.socket.MessageHandler.lambda$decode$36(MessageHandler.java:370)

The reason for multiple disconnects / reconnecting during each day is unknown (for me) ...

GDB4J avatar Oct 21 '22 16:10 GDB4J

Looks like i got it to work in the latest commit with some changes to my protobuf library, only a little bit of work is left before a perfect release

Auties00 avatar Nov 02 '22 17:11 Auties00

Fixed in latest commit, will be available for everyone when I release 3.0

Auties00 avatar Nov 13 '22 14:11 Auties00

it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1 SEVERE: Socket failure at CRYPTOGRAPHY java.lang.RuntimeException: Detected a bad mac

laotong95 avatar Dec 25 '23 04:12 laotong95