# Buggy code
def __init__(self, parent=None):
    super().__init__(parent)
    self.setupUi(parent)

    # Populate dropdowns
    self.repoSelector.model().item(0).setEnabled(False)
    self.repoSelector.addItem(self.tr("+ Initialize New Repository"), "new")
    self.repoSelector.addItem(self.tr("+ Add Existing Repository"), "existing")
    self.repoSelector.insertSeparator(3)
    for repo in RepoModel.select():
        self.repoSelector.addItem(repo.url, repo.id)

    self.repoSelector.currentIndexChanged.connect(self.repo_select_action)
    self.repoRemoveToolbutton.clicked.connect(self.repo_unlink_action)

    # note: it is hard to describe these algorithms with attributes like low/medium/high
    # compression or speed on a unified scale. this is not 1-dimensional and also depends
    # on the input data. so we just tell what we know for sure.
    # "auto" is used for some slower / older algorithms to avoid wasting a lot of time
    # on uncompressible data.
    self.repoCompression.addItem(self.tr("LZ4 (modern, default)"), "lz4")
    self.repoCompression.addItem(self.tr("Zstandard Level 3 (modern)"), "zstd,3")
    self.repoCompression.addItem(self.tr("Zstandard Level 8 (modern)"), "zstd,8")

    # zlib and lzma come from python stdlib and are there (and in borg) since long.
    # but maybe not much reason to start with these nowadays, considering zstd supports
    # a very wide range of compression levels and has great speed. if speed is more
    # important than compression, lz4 is even a little better.
    self.repoCompression.addItem(self.tr("ZLIB Level 6 (auto, legacy)"), "auto,zlib,6")
    self.repoCompression.addItem(self.tr("LZMA Level 6 (auto, legacy)"), "auto,lzma,6")
    self.repoCompression.addItem(self.tr("No Compression"), "none")
    self.repoCompression.currentIndexChanged.connect(self.compression_select_action)

    self.toggle_available_compression()
    self.repoCompression.currentIndexChanged.connect(self.compression_select_action)

    self.init_ssh()
    self.sshComboBox.currentIndexChanged.connect(self.ssh_select_action)
    self.sshKeyToClipboardButton.clicked.connect(self.ssh_copy_to_clipboard_action)

    self.init_repo_stats()
    self.populate_from_profile()
    self.set_icons()


# Traceback (IndexError)
Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/peewee.py", line 6665, in get
return clone.execute(database)[0]
File "/app/lib/python3.7/site-packages/peewee.py", line 4121, in __getitem__
return self.row_cache[item]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/vorta/application.py", line 80, in open_main_window_action
self.main_window = MainWindow(self)
File "/app/lib/python3.7/site-packages/vorta/views/main_window.py", line 37, in __init__
self.repoTab = RepoTab(self.repoTabSlot)
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 59, in __init__
self.init_repo_stats()
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 74, in init_repo_stats
repo = self.profile().repo
File "/app/lib/python3.7/site-packages/peewee.py", line 4269, in __get__
return self.get_rel_instance(instance)
File "/app/lib/python3.7/site-packages/peewee.py", line 4260, in get_rel_instance
obj = self.rel_model.get(self.field.rel_field == value)
File "/app/lib/python3.7/site-packages/peewee.py", line 6242, in get
return sq.get()
File "/app/lib/python3.7/site-packages/peewee.py", line 6670, in get
(clone.model, sql, params))
vorta.models.RepoModelDoesNotExist: <Model: RepoModel> instance matching query does not exist:
SQL: SELECT "t1"."id", "t1"."url", "t1"."added_at", "t1"."encryption", "t1"."unique_size", "t1"."unique_csize", "t1"."total_size", "t1"."total_unique_chunks", "t1"."extra_borg_arguments" FROM "repomodel" AS "t1" WHERE ("t1"."id" = ?) LIMIT ? OFFSET ?
Params: [1, 1, 0]

# Fixed code
def __init__(self, parent=None):
    super().__init__(parent)
    self.setupUi(parent)

    # Populate dropdowns
    self.repoSelector.model().item(0).setEnabled(False)
    self.repoSelector.addItem(self.tr("+ Initialize New Repository"), "new")
    self.repoSelector.addItem(self.tr("+ Add Existing Repository"), "existing")
    self.repoSelector.insertSeparator(3)
    self.set_repos()
    self.repoSelector.currentIndexChanged.connect(self.repo_select_action)
    self.repoRemoveToolbutton.clicked.connect(self.repo_unlink_action)

    # note: it is hard to describe these algorithms with attributes like low/medium/high
    # compression or speed on a unified scale. this is not 1-dimensional and also depends
    # on the input data. so we just tell what we know for sure.
    # "auto" is used for some slower / older algorithms to avoid wasting a lot of time
    # on uncompressible data.
    self.repoCompression.addItem(self.tr("LZ4 (modern, default)"), "lz4")
    self.repoCompression.addItem(self.tr("Zstandard Level 3 (modern)"), "zstd,3")
    self.repoCompression.addItem(self.tr("Zstandard Level 8 (modern)"), "zstd,8")

    # zlib and lzma come from python stdlib and are there (and in borg) since long.
    # but maybe not much reason to start with these nowadays, considering zstd supports
    # a very wide range of compression levels and has great speed. if speed is more
    # important than compression, lz4 is even a little better.
    self.repoCompression.addItem(self.tr("ZLIB Level 6 (auto, legacy)"), "auto,zlib,6")
    self.repoCompression.addItem(self.tr("LZMA Level 6 (auto, legacy)"), "auto,lzma,6")
    self.repoCompression.addItem(self.tr("No Compression"), "none")
    self.repoCompression.currentIndexChanged.connect(self.compression_select_action)

    self.toggle_available_compression()
    self.repoCompression.currentIndexChanged.connect(self.compression_select_action)

    self.init_ssh()
    self.sshComboBox.currentIndexChanged.connect(self.ssh_select_action)
    self.sshKeyToClipboardButton.clicked.connect(self.ssh_copy_to_clipboard_action)

    self.init_repo_stats()
    self.populate_from_profile()
    self.set_icons()