vorta icon indicating copy to clipboard operation
vorta copied to clipboard

Error: NOT NULL constraint failed: backupprofilemodel.compression on starting with a profile with custom compression

Open Kyshman opened this issue 1 year ago • 4 comments

Description

Vorta fails to start when launched from the GUI with no indication as to why. Launching from terminal provides feedback and clue to the origin of the following:

sqlite3.IntegrityError: NOT NULL constraint failed: backupprofilemodel.compression

Steps to reproduce

  1. Import repo and profile from a json file with compression set to any other valid borg value apart from the ones listed on the vorta dropdown. In my case "compression": "zstd,22"
  2. Run initial backup after initialising the repo. The backup is successful.
  3. Subsequently vorta fails to start with the series of errors as shown in the logs below.

Reproduction

  • [X] I tried to reproduce the issue.
  • [X] I was able to reproduce the issue.

OS

"Kernel: 6.1.55-1-MANJARO, arch: x86_64", "Desktop: Xfce, v: 4.18.1", "tk: Gtk v: 3.24.36"

Version of Vorta

0.8.12-1

What did you install Vorta with?

Distribution package

Version of Borg

1.2.6

Logs

Gui cant launch so here is the terminal output;

2023-11-07 19:07:19,727 - vorta.i18n - DEBUG - Loading translation failed for ['en-GB', 'en-Latn-GB'].
2023-11-07 19:07:19,785 - root - DEBUG - Not a private SSH key file: authorized_keys
2023-11-07 19:07:19,817 - root - CRITICAL - Uncaught exception, file a report at https://github.com/borgbase/vorta/issues/new/choose
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/peewee.py", line 3251, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.IntegrityError: NOT NULL constraint failed: backupprofilemodel.compression

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/vorta/views/repo_tab.py", line 231, in compression_select_action
    profile.save()
  File "/usr/lib/python3.11/site-packages/playhouse/signals.py", line 71, in save
    ret = super(Model, self).save(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/peewee.py", line 6804, in save
    rows = self.update(**field_dict).where(self._pk_expr()).execute()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/peewee.py", line 1971, in inner
    return method(self, database, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/peewee.py", line 2042, in execute
    return self._execute(database)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/peewee.py", line 2560, in _execute
    cursor = database.execute(self)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/peewee.py", line 3259, in execute
    return self.execute_sql(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/peewee.py", line 3249, in execute_sql
    with __exception_wrapper__:
  File "/usr/lib/python3.11/site-packages/peewee.py", line 3019, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
  File "/usr/lib/python3.11/site-packages/peewee.py", line 192, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.11/site-packages/peewee.py", line 3251, in execute_sql
    cursor.execute(sql, params or ())
peewee.IntegrityError: NOT NULL constraint failed: backupprofilemodel.compression

Kyshman avatar Nov 07 '23 17:11 Kyshman

Borg info output after the initialization and creation of the repo which might assist.

Command line: /usr/bin/borg create --list --progress --info --log-json --json --filter=AM -C zstd,22 --exclude-from /tmp/tmpn8zd7cy8 --exclude-if-present .nobackup /run/media/tony/ExFAT_Kysh/backup-home/tony::$REPO_NAME $HOME

Kyshman avatar Nov 07 '23 17:11 Kyshman

Can you provide some more info related to you environment and how you installed Borg and Vorta. I cant see such issue happening with me. For me, I'm using Arch Linux (Gnome DE), Installed Vorta with pip and borg using AUR

SAMAD101 avatar Nov 09 '23 06:11 SAMAD101

Thank you for reporting this issue @Kyshman.

When importing the profile export file, the following code will be executed to choose the correct item in the compression ComboBox.

https://github.com/borgbase/vorta/blob/567a3546ae09878cf64f9f10c5c6f7bb7254720e/src/vorta/views/repo_tab.py#L103

Since the compression stored in the profile export is no longer available as an option, findData will return -1. In turn the ComboBox enters a state in which no item is selected. This triggers a db update, which fails since compression will be set to None resulting in the error message reported.

https://github.com/borgbase/vorta/blob/567a3546ae09878cf64f9f10c5c6f7bb7254720e/src/vorta/views/repo_tab.py#L233-L236

There are two ways we could go about compressions no longer in our opinionated list of selectable compressions. Either we try to select the compression option that is closest to the imported value or we (temporarily) add the custom compression option to the ComboBox. It should be noted that zstd,22 is a compression option that wasn't selectable inside Vorta at any point in time.

What do you think @m3nu?

real-yfprojects avatar Dec 08 '23 16:12 real-yfprojects

It should be noted that zstd,22 is a compression option that wasn't selectable inside Vorta at any point in time.

You're quite right. Here is my process flow to explain how I arrived at the 'zstd,22' compression option.

  1. Already have a manually started repo with borg done on the cli with the 'zstd,22' compression
  2. Create a dummy repo with Vorta and select all option needed
  3. Export the profile to JSON file.
  4. Edit the file to suit my original repo with the 'zstd,22' compression
  5. Delete the dummy repo on Vorta
  6. Import the JSON file into Vorta
  7. Initial run succeeds
  8. Vorta fails to start on subsequent runs.

Kyshman avatar Dec 09 '23 10:12 Kyshman

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 08 '24 02:04 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Apr 15 '24 02:04 github-actions[bot]