AsamK / signal-cli

signal-cli provides an unofficial commandline, JSON-RPC and dbus interface for the Signal messenger.
GNU General Public License v3.0
3.22k stars 306 forks source link

ERROR AddDeviceCommand - Add device link failed: StatusCode: 411 #1573

Closed badiann-create closed 2 months ago

badiann-create commented 2 months ago

Hello,

Current error message

I can no longer add my account with signal-cli on debian preventing me from using signal-desktop. I have this error message and I don't know how to solve it:

$ signal-cli -u +33xxxxxxx addDevice --uri "sgnl:xxxxxx"

INFO  AccountHelper - The Signal protocol expects that incoming messages are regularly received.
ERROR AddDeviceCommand - Add device link failed: StatusCode: 411
Add device link failed

Some information

$ signal-cli -v -u +33xxxxxxx addDevice --uri "sgnl://xxxxxxx"

2024-08-24T12:26:21.199+0200 [main] DEBUG org.asamk.signal.App - Starting signal-cli 0.13.5
2024-08-24T12:26:21.483+0200 [main] DEBUG org.asamk.signal.util.IOUtils - XDG_DATA_HOME not set, falling back to home dir
2024-08-24T12:26:21.829+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2024-08-24T12:26:21.954+0200 [main] INFO  com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.sqlite.jdbc4.JDBC4Connection@66b7550d
2024-08-24T12:26:21.956+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
2024-08-24T12:26:22.099+0200 [main] INFO  o.a.s.manager.helper.AccountHelper - The Signal protocol expects that incoming messages are regularly received.
2024-08-24T12:26:24.319+0200 [main] ERROR o.a.signal.commands.AddDeviceCommand - Add device link failed: StatusCode: 411
2024-08-24T12:26:24.325+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2024-08-24T12:26:24.327+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
Add device link failed
org.whispersystems.signalservice.internal.push.DeviceLimitExceededException: StatusCode: 411
    at org.whispersystems.signalservice.internal.push.PushServiceSocket.validateServiceResponse(PushServiceSocket.java:2314)
    at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:2277)
    at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:2214)
    at org.whispersystems.signalservice.internal.push.PushServiceSocket.makeServiceRequest(PushServiceSocket.java:2208)
    at org.whispersystems.signalservice.internal.push.PushServiceSocket.getNewDeviceVerificationCode(PushServiceSocket.java:691)
    at org.whispersystems.signalservice.api.SignalServiceAccountManager.getNewDeviceVerificationCode(SignalServiceAccountManager.java:679)
    at org.asamk.signal.manager.helper.AccountHelper.addDevice(AccountHelper.java:470)
    at org.asamk.signal.manager.internal.ManagerImpl.addDeviceLink(ManagerImpl.java:494)
    at org.asamk.signal.commands.AddDeviceCommand.handleCommand(AddDeviceCommand.java:51)
    at org.asamk.signal.commands.CommandHandler.handleLocalCommand(CommandHandler.java:35)
    at org.asamk.signal.App.handleLocalCommand(App.java:278)
    at org.asamk.signal.App.handleCommand(App.java:179)
    at org.asamk.signal.App.init(App.java:144)
    at org.asamk.signal.Main.main(Main.java:56)

Debian version : bookworm

$ java -version

java version "21.0.4" 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 21.0.4+8-LTS-274)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.4+8-LTS-274, mixed mode, sharing)

I'm not very good at computers.

Problem history:

I'll clarify that if it helps to understand the problem.

About ten days ago signal stopped working with this error message:

Unhandled Promise Rejection: Error: Error: Not initialized
    at MessagePort.<anonymous> (/snap/signal-desktop/682/opt/Signal/resources/app.asar/ts/sql/mainWorker.js:103:13)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
    at Worker.<anonymous> (/snap/signal-desktop/682/opt/Signal/resources/app.asar/ts/sql/main.js:233:26)
    at Worker.emit (node:events:519:28)
    at MessagePort.<anonymous> (node:internal/worker:262:53)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)

Trying to redo steps 6 / 7 / 8 to install signal without smartphone (https://kemenaran.winosx.com/posts/signal-sans-smartphone), I realize that signal-cli no longer works. I haven't updated it since the beginning. I re-download the latest version. I get another error message because the new version of signal-cli doesn't work with the default debian java version. I change java version with openjdk-21-jdk (following this procedure: https://www.tecmint.com/install-java-on-debian-12 ). Signal-desktop works again, I can send messages even though I've lost all my data. I restart the computer, signal doesn't work again. I realize that snap no longer works, with an error message :

error: system does not fully support snapd: cannot mount squashfs image using "squashfs": exec:
       "mount": executable file not found in $PATH

I take the steps indicated here : https://forum.snapcraft.io/t/snapd-install-refresh-remove-error/11445

Snap is repaired, so I'll take this opportunity to uninstall signal-desktop via snap and reinstall it using the procedure indicated by signal for linux.

I end up with this new error message:

ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-21-oracle-x64

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation. 

I perform the solution indicated in this post: https://askubuntu.com/questions/554045/java-home-is-set-to-the-wrong-directory

Signal works again, I repeat the command via signal-cli to add my number, all goes well.

I restart the computer, signal reindicts that I must delete all the data and restart signal, then I get the error message indicated at the top of the post via signal-cli (Add device link failed: StatusCode: 411).

Do you have any solutions?

Thank you

AsamK commented 2 months ago

You might have too many linked devices already. You can check with the listDevices command and remove old devices with removeDevice

badiann-create commented 2 months ago

Hey,

Thank you very much. I had tried to list the devices but I had done it wrong. This seems to solve the problem.

AsamK commented 2 months ago

Thanks for confirming, I'll leave this open to add a better error message for DeviceLimitExceededException