borgbackup / borgbackup/borg

Cover more common exceptions with errors

Open
#7,016 7 comments 5 reactions 1 assignee Claimed by @ThomasWaldmann View on GitHub
Dominant language
Python
Stars
13.7k
Forks
875
Avg merge
11h 15m
Merged PRs (30d)
192

Description

There has been some user feedback where people were confused about what to do with some error messages. So I collected all the things about error messages that came to my mind.

#### Target not writeable for `borg init`

This has been an evergreen with missing permissions on USB drives. I guess this is easy to make a it a proper error with a msgid?

```py
borg/repository.py\", line 248, in check_can_create_repository
st = os.stat(path)\nPermissionError: [Errno 13] Permission denied
```

#### Broken cache

I found those two, one after a power outage. Not sure how the other one happened. Both got fixed by deleting the cache. So it would be nice to give the option to delete the cache in the user interface in those cases.

However, they are both quite different. Not sure if there would be a good way to catch general cache issues and assign them a msgid?

```py
raise Exception('%s does not look like a Borg cache.' % config_path)
```
and
```py
"src/borg/hashindex.pyx", line 99, in borg.hashindex.IndexBase.__cinit__
ValueError: Could not read header (expected 18, but read 0 bytes)
```

#### Connection loss

This seems to happen when my system goes to sleep and backup is running and waking it up again. It does not trigger the usual ConnectionClosed(WithHint)

```py
File "/app/lib/python3.9/site-packages/borg/remote.py", line 709, in call
for resp in self.call_many(cmd, [args], **kw):
File "/app/lib/python3.9/site-packages/borg/remote.py", line 779, in call_many
send_buffer() # Try to send data, as some cases (async_response) will never try to send data otherwise.
File "/app/lib/python3.9/site-packages/borg/remote.py", line 719, in send_buffer
written = self.ratelimit.write(self.stdin_fd, self.to_send.peek_front())
File "/app/lib/python3.9/site-packages/borg/remote.py", line 417, in write
written = os.write(fd, to_send)
BrokenPipeError: [Errno 32] Broken pipe
```

#### ConnectionClosedWithHint

Somewhat related to errors: `ConnectionClosedWithHint` does not seem to be documented as msgid. It would be great if the hint could also be part of the error. But I haven't checked the code yet if there is a problem with that.

#### Repository.AtticRepository

I guess it would be great to have something similar in borg 1.2.x and borg 2.x to explain "install 2.0/1.2.x to use this repo" respectively?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.