Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Socket failure at MESSAGE(Cannot decrypt message: no suitable session found)

See original GitHub issue

@Auties00 Probly a duplicate of

2022-06-26 22:26:39,207 |  WARN | Grizzly(1) | it.auties.whatsapp.binary.Socket | Socket failure at MESSAGE(Cannot decrypt message: no suitable session found)
2022-06-26 22:26:39,208 |  WARN | Grizzly(1) | it.auties.whatsapp.binary.Socket | Saved stacktrace at: /home/user/.whatsappweb4j/exceptions/1656275199207.txt
2022-06-26 22:26:39,208 |  WARN | Grizzly(1) | it.auties.whatsapp.binary.Socket | Ignoring failure


java.util.NoSuchElementException: Cannot decrypt message: no suitable session found
	at it.auties.whatsapp.crypto.SessionCipher.decrypt(
	at it.auties.whatsapp.binary.Socket$MessageHandler.decode(
	at it.auties.whatsapp.binary.Socket$MessageHandler.decode(
	at it.auties.whatsapp.binary.Socket$MessageHandler.lambda$decode$34(
	at java.base/java.lang.Iterable.forEach(
	at it.auties.whatsapp.binary.Socket$MessageHandler.decode(
	at it.auties.whatsapp.binary.Socket$StreamHandler.digest(
	at it.auties.whatsapp.binary.Socket.handleNode(
	at java.base/java.lang.Iterable.forEach(
	at it.auties.whatsapp.binary.Socket.onBinary(
	at jdk.internal.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.base/java.lang.reflect.Method.invoke(
	at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(
	at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(
	at org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(
	at org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(
	at org.glassfish.tyrus.core.TyrusWebSocket.onMessage(
	at org.glassfish.tyrus.core.frame.BinaryFrame.respond(
	at org.glassfish.tyrus.core.ProtocolHandler.process(
	at org.glassfish.tyrus.client.TyrusClientEngine$TyrusReadHandler.handle(
	at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter$ProcessTask.execute(
	at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(
	at org.glassfish.tyrus.container.grizzly.client.TaskProcessor.processTask(
	at org.glassfish.tyrus.container.grizzly.client.GrizzlyClientFilter.handleRead(
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(
	at org.glassfish.grizzly.ProcessorExecutor.execute(
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$
	at java.base/
Caused by: java.lang.IllegalArgumentException: Key used already or never filled
	at java.base/jdk.internal.reflect.GeneratedConstructorAccessor41.newInstance(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(
	at java.base/java.lang.reflect.Constructor.newInstance(
	at it.auties.whatsapp.util.Validate.createThrowable(
	at it.auties.whatsapp.util.Validate.isTrue(
	at it.auties.whatsapp.util.Validate.isTrue(
	at it.auties.whatsapp.crypto.SessionCipher.decrypt(
	at it.auties.whatsapp.crypto.SessionCipher.tryDecrypt(
	at it.auties.whatsapp.crypto.SessionCipher.decrypt(
	... 38 more

These exceptions are coming “randomly” in the application log. Not that big of an issue but:

  • is it possible to fix this or how can I fix it?
  • Is there a way it is no longer written to a file, as this take unnecessary diskspace after a while?
  • Can we configure the way exceptions are treated?


  • Spring boot 2.6.6
  • JDK 17.0.2
  • whatsappweb4j 3.0-RC11

#Priority: Low

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

Auties00commented, Jun 26, 2022

Oh well, I played myself. I introduced this bug myself without even noticing it when I restructured the serialization process. I moved that logic inside a listener which was fired from a shutdown hook asynchronously. Obviously, this meant that the application couldn’t serialize its data as running async operations while your application is shutting down is the perfect way to avoid running it. I’m fixing it rn and will test further to see if this fixes the problem

Auties00commented, Jun 26, 2022

Are the messages deserialized correctly though? Like can you read all incoming messages despite this exception?

Well, not tested so far. Currently using only “api.sendMessage”.

so even more reason to assume that this “default” shouldn’t be a problem(or throws exceptions) right?

So I was testing and it looks like the bot disconnects at some point, reconnects and throws those errors. Interesting

Read more comments on GitHub >

github_iconTop Results From Across the Web

Message decryption errors · Issue #162 - GitHub
NoSuchElementException: Cannot find state with id 1712577466 at ... Socket failure at MESSAGE(Cannot decrypt message: no suitable session ...
Read more >
GPG Mail can't decrypt message - GPGTools Support
Sometimes things go wrong and a message is not decrypted along with an error message Secret key to decrypt the message is missing...
Read more >
Protocol utilities messages - CyberArk Docs
This error message is caused by a corrupted request that was sent to the provider by one of the SDKs. Try to resend...
Read more >
Chat Encryption: Messages fail to decrypt randomly
Sometimes chats will fail to decrypt for one person and at no point does the "decryption key become available" no matter what they...
Read more >
WMQ JMS Exception Messages - IBM
Error Code Message Explanation AMS1047 Alias not found in the keystore An alias is not found in the keystore. AMS1051 Failed to initialize the keystore...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found