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.24k stars 309 forks source link

Getting Failed update pre_key store after updating from 0.9.2 to 0.11.3 #1055

Closed piratenpanda closed 2 years ago

piratenpanda commented 2 years ago

As we could not use the old version I upgraded to the latest. All actions fail with:

Error loading state file for user +123456: Failed update pre_key store (RuntimeException)

Is there anything I can do to fix this except unregister and register again?

AsamK commented 2 years ago

Please run signal-cli with the --verbose flag to get a more detailed error log

piratenpanda commented 2 years ago

It says unrecognized argument --verbose

piratenpanda commented 2 years ago

Ah needs to be the first command now it works

piratenpanda commented 2 years ago

It gives the following output:

 $SIGNAL_CLI --verbose -a $USER updateAccount
2022-10-18T12:04:06.978+0200 [main] DEBUG org.asamk.signal.util.IOUtils - XDG_RUNTIME_DIR not set, falling back to temp dir
2022-10-18T12:04:07.313+0200 [main] INFO  LibSignal - [libsignal]: rust/bridge/jni/src/logging.rs:156: Initializing libsignal version:0.20.0
2022-10-18T12:04:07.315+0200 [main] DEBUG org.asamk.signal.util.IOUtils - XDG_DATA_HOME not set, falling back to home dir
2022-10-18T12:04:07.636+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2022-10-18T12:04:07.807+0200 [main] INFO  com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.sqlite.jdbc4.JDBC4Connection@c2db68f
2022-10-18T12:04:07.809+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
Error loading state file for user +4940899886071: Failed update pre_key store (RuntimeException)
java.lang.RuntimeException: Failed update pre_key store
        at org.asamk.signal.manager.storage.prekeys.PreKeyStore.storePreKey(PreKeyStore.java:76)
        at org.asamk.signal.manager.storage.SignalAccount.addPniPreKeys(SignalAccount.java:1023)
        at org.asamk.signal.manager.storage.SignalAccount.addPreKeys(SignalAccount.java:1001)
        at org.asamk.signal.manager.helper.PreKeyHelper.generatePreKeys(PreKeyHelper.java:67)
        at org.asamk.signal.manager.helper.PreKeyHelper.refreshPreKeys(PreKeyHelper.java:56)
        at org.asamk.signal.manager.helper.PreKeyHelper.refreshPreKeysIfNecessary(PreKeyHelper.java:38)
        at org.asamk.signal.manager.helper.PreKeyHelper.refreshPreKeysIfNecessary(PreKeyHelper.java:33)
        at org.asamk.signal.manager.helper.AccountHelper.checkAccountState(AccountHelper.java:66)
        at org.asamk.signal.manager.ManagerImpl.checkAccountState(ManagerImpl.java:193)
        at org.asamk.signal.manager.SignalAccountFiles.initManager(SignalAccountFiles.java:117)
        at org.asamk.signal.manager.SignalAccountFiles.initManager(SignalAccountFiles.java:80)
        at org.asamk.signal.App.loadManager(App.java:348)
        at org.asamk.signal.App.handleLocalCommand(App.java:281)
        at org.asamk.signal.App.init(App.java:222)
        at org.asamk.signal.Main.main(Main.java:60)
Caused by: org.sqlite.SQLiteException: [SQLITE_CONSTRAINT_UNIQUE] A UNIQUE constraint failed (UNIQUE constraint failed: pre_key.account_id_type, pre_key.key_id)        at org.sqlite.core.DB.newSQLException(DB.java:1135)
        at org.sqlite.core.DB.newSQLException(DB.java:1146)
        at org.sqlite.core.DB.execute(DB.java:941)
        at org.sqlite.core.DB.executeUpdate(DB.java:1010)
        at org.sqlite.jdbc3.JDBC3PreparedStatement.lambda$executeLargeUpdate$2(JDBC3PreparedStatement.java:117)
        at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:429)
        at org.sqlite.jdbc3.JDBC3PreparedStatement.executeLargeUpdate(JDBC3PreparedStatement.java:116)
        at org.sqlite.jdbc3.JDBC3PreparedStatement.executeUpdate(JDBC3PreparedStatement.java:98)
        at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
        at org.asamk.signal.manager.storage.prekeys.PreKeyStore.storePreKey(PreKeyStore.java:72)
        ... 14 more
AsamK commented 2 years ago

Thanks. I've pushed a workaround for this issue, not sure how it got into that state... You can try the development build from here: https://github.com/AsamK/signal-cli/actions/runs/3274991280 It should show the error message once again, but then continue working normally.

piratenpanda commented 2 years ago

Will try tomorrow thanks for the quick fix

piratenpanda commented 2 years ago

Working fine again, thanks!