Auties00 / Cobalt

Standalone unofficial fully-featured Whatsapp Web and Mobile API for Java and Kotlin
MIT License
661 stars 188 forks source link

Message decoding error #289

Closed wf4java closed 10 months ago

wf4java commented 1 year ago

2023 2:38:57 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt WARNING: Cannot decode message(id: 3A38DB588622A0317A6B, from: 79635946310@s.whatsapp.net): Cannot decrypt message: no suitable session found

image

Tranlate: Waiting for a message. It can take some time. More ↓↓↓↓↓↓↓↓↓↓↓↓ 4990E01E-4F86-4475-AF69-B42B0ACC6813

Tranlate: Synchronization is in progress. Don't close the app ↓↓↓↓↓↓↓↓↓↓↓↓ image

The first time everything is fine for 30-60 minutes, then this garbage starts

Auties00 commented 1 year ago

what version are you using? can you show me your code?

wf4java commented 1 year ago

version 3.4.0

code: image

image

image

wf4java commented 1 year ago

I also noticed when this happens, sometimes these errors:

java.io.UncheckedIOException: Cannot read smile at it.auties.whatsapp.util.Smile.readValue(Smile.java:95) at it.auties.whatsapp.controller.DefaultControllerSerializer$SmileFile.read(DefaultControllerSerializer.java:368) at it.auties.whatsapp.controller.DefaultControllerSerializer$SmileFile.read(DefaultControllerSerializer.java:355) at it.auties.whatsapp.controller.DefaultControllerSerializer.deserializeKeysFromId(DefaultControllerSerializer.java:188) at it.auties.whatsapp.controller.DefaultControllerSerializer.deserializeKeys(DefaultControllerSerializer.java:176) at it.auties.whatsapp.controller.Keys.of(Keys.java:233) at it.auties.whatsapp.api.OptionsBuilder.(OptionsBuilder.java:24) at it.auties.whatsapp.api.WebOptionsBuilder.(WebOptionsBuilder.java:13) at it.auties.whatsapp.api.ConnectionBuilder.createConnection(ConnectionBuilder.java:108) at it.auties.whatsapp.api.ConnectionBuilder.lastConnection(ConnectionBuilder.java:101) at wf.bot.whatsapp_bot.main.Main.init(Main.java:52) at wf.bot.whatsapp_bot.main.Main.main(Main.java:26) Caused by: java.io.EOFException: Unexpected end of ZLIB input stream at java.base/java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:244) at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) at java.base/java.util.zip.GZIPInputStream.read(GZIPInputStream.java:117) at com.fasterxml.jackson.dataformat.smile.SmileParser._loadMore(SmileParser.java:257) at com.fasterxml.jackson.dataformat.smile.SmileParser.nextToken(SmileParser.java:415) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4817) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4723) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3722) at it.auties.whatsapp.util.Smile.readValue(Smile.java:93) ... 11 more

wf4java commented 1 year ago

image

Auties00 commented 1 year ago

version 3.4.0

code: image

image

image

I'll test it when I'm home

Auties00 commented 1 year ago

can you test with the Master branch?

wf4java commented 1 year ago

I don't know why, but I can't compile the project, I downloaded it and I can't compile. Should I wait for the release in maven?

image image

Auties00 commented 1 year ago

I don't know why, but I can't compile the project, I downloaded it and I can't compile. Should I wait for the release in maven?

image image

Can you try now? I've pushed a new commit Also delete your session when testing

wf4java commented 1 year ago

I'm doing tests, please wait

wf4java commented 1 year ago

The error has not disappeared, but right now it somehow arises differently, I do not fully understand how. But he was able to work several hours in a row several times. And the same error

Auties00 commented 1 year ago

i figured it out, I'll push a commit later today

wf4java commented 1 year ago

java.io.UncheckedIOException: Cannot read smile at it.auties.whatsapp.util.Smile.readValue(Smile.java:95) at it.auties.whatsapp.controller.DefaultControllerSerializer$SmileFile.read(DefaultControllerSerializer.java:368) at it.auties.whatsapp.controller.DefaultControllerSerializer$SmileFile.read(DefaultControllerSerializer.java:355) at it.auties.whatsapp.controller.DefaultControllerSerializer.deserializeStoreFromId(DefaultControllerSerializer.java:208) at it.auties.whatsapp.controller.DefaultControllerSerializer.deserializeStore(DefaultControllerSerializer.java:196) at it.auties.whatsapp.controller.Store.of(Store.java:398) at it.auties.whatsapp.api.OptionsBuilder.(OptionsBuilder.java:23) at it.auties.whatsapp.api.WebOptionsBuilder.(WebOptionsBuilder.java:13) at it.auties.whatsapp.api.ConnectionBuilder.createConnection(ConnectionBuilder.java:108) at it.auties.whatsapp.api.ConnectionBuilder.lastConnection(ConnectionBuilder.java:101) at wf.bot.whatsapp_bot.main.Main.init(Main.java:53) at wf.bot.whatsapp_bot.main.Main.main(Main.java:26) Caused by: java.io.EOFException: Unexpected end of ZLIB input stream at java.base/java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:244) at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) at java.base/java.util.zip.GZIPInputStream.read(GZIPInputStream.java:117) at com.fasterxml.jackson.dataformat.smile.SmileParser._loadMore(SmileParser.java:257) at com.fasterxml.jackson.dataformat.smile.SmileParser.nextToken(SmileParser.java:415) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4817) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4723) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3722) at it.auties.whatsapp.util.Smile.readValue(Smile.java:93) ... 11 more июн. 01, 2023 8:54:43 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt WARNING: Cannot decode message(id: EACAFC981A2AC82E2E05566F56A419A6, from: 79899255873-1630398938@g.us): Cannot find state with id 970146628 Connected Logged in июн. 01, 2023 9:34:53 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt WARNING: Cannot decode message(id: EACAFC981A2AC82E2E05566F56A419A6, from: 79899255873-1630398938@g.us): Cannot find state with id 970146628 июн. 01, 2023 9:34:54 PM it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1 SEVERE: Socket failure at CRYPTOGRAPHY java.lang.RuntimeException: Detected a bad mac at it.auties.whatsapp.socket.StreamHandler.digestError(StreamHandler.java:547) at it.auties.whatsapp.socket.StreamHandler.digest(StreamHandler.java:88) at it.auties.whatsapp.socket.SocketHandler.onMessage(SocketHandler.java:172) at it.auties.whatsapp.socket.SocketSession.readMessages(SocketSession.java:122) at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) июн. 01, 2023 9:34:54 PM it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1 WARNING: Socket failure at CRYPTOGRAPHY Disconnect: RESTORE Disconnected Reconnecting java.util.concurrent.CompletionException: java.io.UncheckedIOException: Cannot complete file write at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1807) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) Caused by: java.io.UncheckedIOException: Cannot complete file write at it.auties.whatsapp.controller.DefaultControllerSerializer$SmileFile.writeSync(DefaultControllerSerializer.java:396) at it.auties.whatsapp.controller.DefaultControllerSerializer$SmileFile.lambda$write$0(DefaultControllerSerializer.java:378) at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ... 6 more Caused by: java.nio.file.NoSuchFileException: C:\Users\momop.whatsapp4j\web\a4d7f40f-4ad0-4de9-9eab-dfb689068b3c\keys.smile at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236) at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484) at java.base/java.nio.file.Files.newOutputStream(Files.java:228) at it.auties.whatsapp.controller.DefaultControllerSerializer$SmileFile.writeSync(DefaultControllerSerializer.java:391) ... 8 more июн. 01, 2023 9:34:55 PM it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1 SEVERE: Socket failure at UNKNOWN java.lang.RuntimeException: Cannot lock on media connection at it.auties.whatsapp.controller.Store.mediaConnection(Store.java:963) at it.auties.whatsapp.controller.Store.mediaConnection(Store.java:946) at it.auties.whatsapp.api.Whatsapp.attributeMediaMessage(Whatsapp.java:533) at it.auties.whatsapp.api.Whatsapp.attributeMessageMetadata(Whatsapp.java:453) at it.auties.whatsapp.api.Whatsapp.sendMessage(Whatsapp.java:442) at it.auties.whatsapp.api.Whatsapp.sendMessage(Whatsapp.java:431) at it.auties.whatsapp.api.Whatsapp.sendMessage(Whatsapp.java:408) at wf.bot.whatsapp_bot.command.DisposableImage.onNewImageMessage(DisposableImage.java:13) at wf.bot.whatsapp_bot.handler.NewMessageHandler.onNewMessage(NewMessageHandler.java:31) at it.auties.whatsapp.socket.SocketHandler.lambda$onNewMessage$28(SocketHandler.java:571) at it.auties.whatsapp.socket.SocketHandler.invokeListenerSafe(SocketHandler.java:660) at it.auties.whatsapp.socket.SocketHandler.lambda$callListenersAsync$2(SocketHandler.java:138) 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:833) Caused by: java.lang.InterruptedException at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1081) at java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:276) at it.auties.whatsapp.controller.Store.mediaConnection(Store.java:957) ... 14 more июн. 01, 2023 9:34:55 PM it.auties.whatsapp.api.ErrorHandler lambda$defaultErrorHandler$1

image image image

wf4java commented 1 year ago

I downloaded master branch 2 hours ago and here are the errors

Auties00 commented 1 year ago

I downloaded master branch 2 hours ago and here are the errors

delete that session switch fo 3.4.2, the latest release try again

wf4java commented 1 year ago

image

Auties00 commented 1 year ago

image

wait for maven central(10/15 minutes) or use the master branch

wf4java commented 1 year ago

The error didn't go away.

WARNING: Cannot decode message(id: 3A4F24E1629B0619A557, from: 79635946310@s.whatsapp.net): Cannot decrypt message: no suitable session found
июн. 02, 2023 8:02:23 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt
WARNING: Cannot decode message(id: 3A63D5CCD91FA467DAB5, from: 79635946310@s.whatsapp.net): Cannot decrypt message: no suitable session found
июн. 02, 2023 8:02:23 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt
WARNING: Cannot decode message(id: 3A6435F8F229421F27D5, from: 79635946310@s.whatsapp.net): Cannot decrypt message: no suitable session found
Connected
Logged in
июн. 02, 2023 8:02:25 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt
WARNING: Cannot decode message(id: 13770A2223034F7A, from: 79635946310:48@s.whatsapp.net): Key used already or never filled
Auties00 commented 1 year ago

The error didn't go away.

WARNING: Cannot decode message(id: 3A4F24E1629B0619A557, from: 79635946310@s.whatsapp.net): Cannot decrypt message: no suitable session found
июн. 02, 2023 8:02:23 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt
WARNING: Cannot decode message(id: 3A63D5CCD91FA467DAB5, from: 79635946310@s.whatsapp.net): Cannot decrypt message: no suitable session found
июн. 02, 2023 8:02:23 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt
WARNING: Cannot decode message(id: 3A6435F8F229421F27D5, from: 79635946310@s.whatsapp.net): Cannot decrypt message: no suitable session found
Connected
Logged in
июн. 02, 2023 8:02:25 PM it.auties.whatsapp.socket.MessageHandler sendRetryReceipt
WARNING: Cannot decode message(id: 13770A2223034F7A, from: 79635946310:48@s.whatsapp.net): Key used already or never filled

did you delete all of the sessions?

wf4java commented 1 year ago

Yes, I deleted all sessions

Auties00 commented 1 year ago

Yes, I deleted all sessions

when does the error happen exactly?

wf4java commented 1 year ago

Before, this error occurred after 1-2 hours or when I restarted the program there was a chance that this error would occur. But this time it was different, it worked for 4-5 hours, and I went to sleep and turned off the computer. After 12-15 hours I turned it on again, and the error happened again.

Auties00 commented 1 year ago

Before, this error occurred after 1-2 hours or when I restarted the program there was a chance that this error would occur. But this time it was different, it worked for 4-5 hours, and I went to sleep and turned off the computer. After 12-15 hours I turned it on again, and the error happened again.

this is very good. in short when you start the bot, all of the messages that were sent while you were offline are sent to you for decryption. the decryption process needs to happen in chronological order(it has to do with the signal protocol), but if the bot receives too many messages the possibility of the order mixing up grows exponentially as the decoding actually happens asynchronously. I thought I fixed this error, but it looks like that's not the case. I'll have a fix shortly, in the meanwhile if you don't stop your bot it will not happen again.

Auties00 commented 1 year ago

Could be fixed in 3.4.5

sbihaiko commented 11 months ago

Hi Auties00. Got an another “Cannot decode message” warning at v3.5.1.

nov. 25, 2023 3:24:35 PM it.auties.whatsapp.socket.MessageHandler decodeMessage WARNING: Cannot decode message(id: 3A1B6CE56625C2FE1AD3, from: 554499981486@s.whatsapp.net): message_decryption

nov. 25, 2023 3:24:47 PM it.auties.whatsapp.socket.MessageHandler decodeMessage WARNING: Cannot decode message(id: 3A2EC2F9F74D0D467271, from: 120363145496978942@g.us): Cannot find state with id 1586454393

Could you help me?

Auties00 commented 11 months ago

Hi Auties00. Got an another “Cannot decode message” warning at v3.5.1.

nov. 25, 2023 3:24:35 PM it.auties.whatsapp.socket.MessageHandler decodeMessage WARNING: Cannot decode message(id: 3A1B6CE56625C2FE1AD3, from: 554499981486@s.whatsapp.net): message_decryption

nov. 25, 2023 3:24:47 PM it.auties.whatsapp.socket.MessageHandler decodeMessage WARNING: Cannot decode message(id: 3A2EC2F9F74D0D467271, from: 120363145496978942@g.us): Cannot find state with id 1586454393

Could you help me?

Use the master branch, this issue has already been fixed a long time ago