bepaald / signalbackup-tools

Tool to work with Signal Backup files.
GNU General Public License v3.0
790 stars 38 forks source link

importfromdesktop fails with "malformed database schema" #168

Closed StefanBrand closed 10 months ago

StefanBrand commented 10 months ago

I'm using the Docker image to run the --importfromdesktop command. My directory contains these files:

Signal.backup  # copied from `.config/Signal`, Desktop version 6.42.0
signal-2023-12-15-15-55-41.backup  # backup from phone app version 6.41.3

When I run the tool, I get an error: malformed database schema

docker run -it -v "$PWD:$PWD" -w "$PWD" signalbackuptools:latest signal-2023-12-15-15-55-41.backup 0000000000 --importfromdesktop Signal.backup Signal.backup --ignorewal --output signal-2023-12-15-15-55-41-fixed.backup
 *** Starting log: 2023-12-15 15:33:04 *** 
signalbackup-tools (signalbackup-tools) source version 20231214.211551
BACKUPFILE VERSION: 1
BACKUPFILE SIZE: 7018850
COUNTER: 1168868873
Reading backup file...
FRAME 1836 (100.0%)... 
Read entire backup file...
done!
Database version: 211
[Error]: During sqlite3_prepare_v2(): malformed database schema (messages) - near "AS": syntax error
         -> Query: "SELECT 1 FROM PRAGMA_TABLE_XINFO('conversations') WHERE name == 'serviceId'"
[Error]: During sqlite3_prepare_v2(): malformed database schema (messages) - near "AS": syntax error
         -> Query: "SELECT 1 FROM PRAGMA_TABLE_XINFO('conversations') WHERE name == 'uuid'"
[Error]: During sqlite3_prepare_v2(): malformed database schema (messages) - near "AS": syntax error
         -> Query: "SELECT 1 FROM PRAGMA_TABLE_XINFO('messages') WHERE name == 'sourceServiceId'"
[Error]: During sqlite3_prepare_v2(): malformed database schema (messages) - near "AS": syntax error
         -> Query: "SELECT 1 FROM PRAGMA_TABLE_XINFO('messages') WHERE name == 'sourceUuid'"
[Error]: During sqlite3_prepare_v2(): malformed database schema (messages) - near "AS": syntax error
         -> Query: "SELECT MAX(MAX(json_extract(json, '$.received_at_ms')),MAX(received_at)) FROM messages"
[Error]: During sqlite3_prepare_v2(): malformed database schema (messages) - near "AS": syntax error
         -> Query: "SELECT rowid,id,e164,type,LOWER() AS 'uuid',groupId,IFNULL(json_extract(json,'$.isArchived'), false) AS 'is_archived',IFNULL(json_extract(json,'$.isPinned'), false) AS 'is_pinned',IFNULL(json_extract(json,'$.groupId'),'') AS 'json_groupId',IFNULL(json_extract(json,'$.derivedGroupV2Id'),'') AS 'derivedGroupV2Id',IFNULL(json_extract(json,'$.groupVersion'), 1) AS groupVersion FROM conversations WHERE json_extract(json, '$.messageCount') > 0"
StefanBrand commented 10 months ago

Closing. Your comment https://github.com/bepaald/signalbackup-tools/issues/143#issuecomment-1722406821 led me to the correct conclusion: The sqlite3 version was outdated. I changed the Dockerfile to build FROM fedora:39 and then there was no error anymore.

bepaald commented 10 months ago

My favorite kind of issue: solved and closed before I see the notification! 😀

Glad it's all working for you!