Skip to content

Commit

Permalink
update "modern" error RCs (docs and code)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWaldmann committed Nov 9, 2023
1 parent e95a3cd commit d45fb61
Show file tree
Hide file tree
Showing 12 changed files with 235 additions and 112 deletions.
197 changes: 131 additions & 66 deletions docs/internals/frontends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -538,92 +538,157 @@ Message IDs are strings that essentially give a log message or operation a name,
full text, since texts change more frequently. Message IDs are unambiguous and reduce the need to parse
log messages.

Assigned message IDs are:
Assigned message IDs and related error RCs (exit codes) are:

.. See scripts/errorlist.py; this is slightly edited.
Errors
Archive.AlreadyExists
Error rc: 2 traceback: no
Error: {}
ErrorWithTraceback rc: 2 traceback: yes
Error: {}

ExtensionModuleError rc: 2 traceback: no
The Borg binary extension modules do not seem to be properly installed.
PythonLibcTooOld rc: 2 traceback: no
FATAL: this Python was compiled for a too old (g)libc and misses required functionality.
Buffer.MemoryLimitExceeded rc: 2 traceback: no
Requested buffer size {} is above the limit of {}.
EfficientCollectionQueue.SizeUnderflow rc: 2 traceback: no
Could not pop_front first {} elements, collection only has {} elements..

PlaceholderError rc: 5 traceback: no
Formatting Error: "{}".format({}): {}({})
InvalidPlaceholder rc: 6 traceback: no
Invalid placeholder "{}" in string: {}

Repository.AlreadyExists rc: 10 traceback: no
A repository already exists at {}.
Repository.AtticRepository rc: 11 traceback: no
Attic repository detected. Please run "borg upgrade {}".
Repository.CheckNeeded rc: 12 traceback: yes
Inconsistency detected. Please run "borg check {}".
Repository.DoesNotExist rc: 13 traceback: no
Repository {} does not exist.
Repository.InsufficientFreeSpaceError rc: 14 traceback: no
Insufficient free space to complete transaction (required: {}, available: {}).
Repository.InvalidRepository rc: 15 traceback: no
{} is not a valid repository. Check repo config.
Repository.InvalidRepositoryConfig rc: 16 traceback: no
{} does not have a valid configuration. Check repo config [{}].
Repository.ObjectNotFound rc: 17 traceback: yes
Object with key {} not found in repository {}.
Repository.ParentPathDoesNotExist rc: 18 traceback: no
The parent path of the repo directory [{}] does not exist.
Repository.PathAlreadyExists rc: 19 traceback: no
There is already something at {}.
Repository.StorageQuotaExceeded rc: 20 traceback: no
The storage quota ({}) has been exceeded ({}). Try deleting some archives.

MandatoryFeatureUnsupported rc: 25 traceback: no
Unsupported repository feature(s) {}. A newer version of borg is required to access this repository.
NoManifestError rc: 26 traceback: no
Repository has no manifest.
UnsupportedManifestError rc: 27 traceback: no
Unsupported manifest envelope. A newer version is required to access this repository.

Archive.AlreadyExists rc: 30 traceback: no
Archive {} already exists
Archive.DoesNotExist
Archive.DoesNotExist rc: 31 traceback: no
Archive {} does not exist
Archive.IncompatibleFilesystemEncodingError
Archive.IncompatibleFilesystemEncodingError rc: 32 traceback: no
Failed to encode filename "{}" into file system encoding "{}". Consider configuring the LANG environment variable.
Cache.CacheInitAbortedError
Cache initialization aborted
Cache.EncryptionMethodMismatch
Repository encryption method changed since last access, refusing to continue
Cache.RepositoryAccessAborted
Repository access aborted
Cache.RepositoryIDNotUnique
Cache is newer than repository - do you have multiple, independently updated repos with same ID?
Cache.RepositoryReplay
Cache is newer than repository - this is either an attack or unsafe (multiple repos with same ID)
Buffer.MemoryLimitExceeded
Requested buffer size {} is above the limit of {}.
ExtensionModuleError
The Borg binary extension modules do not seem to be properly installed
IntegrityError
Data integrity error: {}
NoManifestError
Repository has no manifest.
PlaceholderError
Formatting Error: "{}".format({}): {}({})
KeyfileInvalidError

KeyfileInvalidError rc: 40 traceback: no
Invalid key file for repository {} found in {}.
KeyfileMismatchError
KeyfileMismatchError rc: 41 traceback: no
Mismatch between repository {} and key file {}.
KeyfileNotFoundError
KeyfileNotFoundError rc: 42 traceback: no
No key file for repository {} found in {}.
PassphraseWrong
passphrase supplied in BORG_PASSPHRASE is incorrect
PasswordRetriesExceeded
exceeded the maximum password retries
RepoKeyNotFoundError
No key entry found in the config of repository {}.
UnsupportedManifestError
Unsupported manifest envelope. A newer version is required to access this repository.
UnsupportedPayloadError
Unsupported payload type {}. A newer version is required to access this repository.
NotABorgKeyFile
NotABorgKeyFile rc: 43 traceback: no
This file is not a borg key backup, aborting.
RepoIdMismatch
RepoKeyNotFoundError rc: 44 traceback: no
No key entry found in the config of repository {}.
RepoIdMismatch rc: 45 traceback: no
This key backup seems to be for a different backup repository, aborting.
UnencryptedRepo
Keymanagement not available for unencrypted repositories.
UnknownKeyType
Keytype {0} is unknown.
LockError
UnencryptedRepo rc: 46 traceback: no
Key management not available for unencrypted repositories.
UnknownKeyType rc: 47 traceback: no
Key type {0} is unknown.
UnsupportedPayloadError rc: 48 traceback: no
Unsupported payload type {}. A newer version is required to access this repository.

NoPassphraseFailure rc: 50 traceback: no
can not acquire a passphrase: {}
PasscommandFailure rc: 51 traceback: no
passcommand supplied in BORG_PASSCOMMAND failed: {}
PassphraseWrong rc: 52 traceback: no
passphrase supplied in BORG_PASSPHRASE, by BORG_PASSCOMMAND or via BORG_PASSPHRASE_FD is incorrect.
PasswordRetriesExceeded rc: 53 traceback: no
exceeded the maximum password retries

Cache.CacheInitAbortedError rc: 60 traceback: no
Cache initialization aborted
Cache.EncryptionMethodMismatch rc: 61 traceback: no
Repository encryption method changed since last access, refusing to continue
Cache.RepositoryAccessAborted rc: 62 traceback: no
Repository access aborted
Cache.RepositoryIDNotUnique rc: 63 traceback: no
Cache is newer than repository - do you have multiple, independently updated repos with same ID?
Cache.RepositoryReplay rc: 64 traceback: no
Cache, or information obtained from the security directory is newer than repository - this is either an attack or unsafe (multiple repos with same ID)

LockError rc: 70 traceback: no
Failed to acquire the lock {}.
LockErrorT
LockErrorT rc: 71 traceback: yes
Failed to acquire the lock {}.
ConnectionClosed
LockFailed rc: 72 traceback: yes
Failed to create/acquire the lock {} ({}).
LockTimeout rc: 73 traceback: no
Failed to create/acquire the lock {} (timeout).
NotLocked rc: 74 traceback: yes
Failed to release the lock {} (was not locked).
NotMyLock rc: 75 traceback: yes
Failed to release the lock {} (was/is locked, but not by me).

ConnectionClosed rc: 80 traceback: no
Connection closed by remote host
InvalidRPCMethod
ConnectionClosedWithHint rc: 81 traceback: no
Connection closed by remote host. {}
InvalidRPCMethod rc: 82 traceback: no
RPC method {} is not valid
PathNotAllowed
Repository path not allowed
RemoteRepository.RPCServerOutdated
PathNotAllowed rc: 83 traceback: no
Repository path not allowed: {}
RemoteRepository.RPCServerOutdated rc: 84 traceback: no
Borg server is too old for {}. Required version {}
UnexpectedRPCDataFormatFromClient
UnexpectedRPCDataFormatFromClient rc: 85 traceback: no
Borg {}: Got unexpected RPC data format from client.
UnexpectedRPCDataFormatFromServer
UnexpectedRPCDataFormatFromServer rc: 86 traceback: no
Got unexpected RPC data format from server:
{}
Repository.AlreadyExists
Repository {} already exists.
Repository.CheckNeeded
Inconsistency detected. Please run "borg check {}".
Repository.DoesNotExist
Repository {} does not exist.
Repository.InsufficientFreeSpaceError
Insufficient free space to complete transaction (required: {}, available: {}).
Repository.InvalidRepository
{} is not a valid repository. Check repo config.
Repository.AtticRepository
Attic repository detected. Please run "borg upgrade {}".
Repository.ObjectNotFound
Object with key {} not found in repository {}.

IntegrityError rc: 100 traceback: yes
Data integrity error: {}
FileIntegrityError rc: 101 traceback: yes
File failed integrity check: {}
DecompressionError rc: 102 traceback: yes
Decompression error: {}

ArchiveTAMInvalid rc: 105 traceback: yes
Data integrity error: {}
ArchiveTAMRequiredError rc: 106 traceback: yes
Archive '{}' is unauthenticated, but it is required for this repository.
TAMInvalid rc: 107 traceback: yes
Data integrity error: {}
TAMRequiredError rc: 108 traceback: yes
Manifest is unauthenticated, but it is required for this repository.

This either means that you are under attack, or that you modified this repository
with a Borg version older than 1.0.9 after TAM authentication was enabled.

In the latter case, use "borg upgrade --tam --force '{}'" to re-authenticate the manifest.
TAMUnsupportedSuiteError rc: 109 traceback: yes
Could not verify manifest: Unsupported suite {!r}; a newer version is needed.

Operations
- cache.begin_transaction
Expand Down
9 changes: 6 additions & 3 deletions src/borg/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,17 @@ def get_item_uid_gid(item, *, numeric, uid_forced=None, gid_forced=None, uid_def

class Archive:

class DoesNotExist(Error):
"""Archive {} does not exist"""

class AlreadyExists(Error):
"""Archive {} already exists"""
exit_mcode = 30

class DoesNotExist(Error):
"""Archive {} does not exist"""
exit_mcode = 31

class IncompatibleFilesystemEncodingError(Error):
"""Failed to encode filename "{}" into file system encoding "{}". Consider configuring the LANG environment variable."""
exit_mcode = 32

def __init__(self, repository, key, manifest, name, cache=None, create=False,
checkpoint_interval=1800, numeric_ids=False, noatime=False, noctime=False,
Expand Down
21 changes: 13 additions & 8 deletions src/borg/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,25 @@ def _check_upgrade(self, config_path):
class Cache:
"""Client Side cache
"""
class RepositoryIDNotUnique(Error):
"""Cache is newer than repository - do you have multiple, independently updated repos with same ID?"""

class RepositoryReplay(Error):
"""Cache, or information obtained from the security directory is newer than repository - this is either an attack or unsafe (multiple repos with same ID)"""

class CacheInitAbortedError(Error):
"""Cache initialization aborted"""
exit_mcode = 60

class EncryptionMethodMismatch(Error):
"""Repository encryption method changed since last access, refusing to continue"""
exit_mcode = 61

class RepositoryAccessAborted(Error):
"""Repository access aborted"""
exit_mcode = 62

class EncryptionMethodMismatch(Error):
"""Repository encryption method changed since last access, refusing to continue"""
class RepositoryIDNotUnique(Error):
"""Cache is newer than repository - do you have multiple, independently updated repos with same ID?"""
exit_mcode = 63

class RepositoryReplay(Error):
"""Cache, or information obtained from the security directory is newer than repository - this is either an attack or unsafe (multiple repos with same ID)"""
exit_mcode = 64

@staticmethod
def break_lock(repository, path=None):
Expand Down
1 change: 1 addition & 0 deletions src/borg/crypto/file_integrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class XXH64FileHashingWrapper(FileHashingWrapper):

class FileIntegrityError(IntegrityError):
"""File failed integrity check: {}"""
exit_mcode = 101


class IntegrityCheckedFile(FileLikeWrapper):
Expand Down
23 changes: 19 additions & 4 deletions src/borg/crypto/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,52 @@

class NoPassphraseFailure(Error):
"""can not acquire a passphrase: {}"""


class PassphraseWrong(Error):
"""passphrase supplied in BORG_PASSPHRASE, by BORG_PASSCOMMAND or via BORG_PASSPHRASE_FD is incorrect."""
exit_mcode = 50


class PasscommandFailure(Error):
"""passcommand supplied in BORG_PASSCOMMAND failed: {}"""
exit_mcode = 51


class PassphraseWrong(Error):
"""passphrase supplied in BORG_PASSPHRASE, by BORG_PASSCOMMAND or via BORG_PASSPHRASE_FD is incorrect."""
exit_mcode = 52


class PasswordRetriesExceeded(Error):
"""exceeded the maximum password retries"""
exit_mcode = 53


class UnsupportedPayloadError(Error):
"""Unsupported payload type {}. A newer version is required to access this repository."""
exit_mcode = 48


class UnsupportedManifestError(Error):
"""Unsupported manifest envelope. A newer version is required to access this repository."""
exit_mcode = 27


class KeyfileNotFoundError(Error):
"""No key file for repository {} found in {}."""
exit_mcode = 42


class KeyfileInvalidError(Error):
"""Invalid key file for repository {} found in {}."""
exit_mcode = 40


class KeyfileMismatchError(Error):
"""Mismatch between repository {} and key file {}."""
exit_mcode = 41


class RepoKeyNotFoundError(Error):
"""No key entry found in the config of repository {}."""
exit_mcode = 44


class TAMRequiredError(IntegrityError):
Expand All @@ -87,18 +97,21 @@ class TAMRequiredError(IntegrityError):
In the latter case, use "borg upgrade --tam --force '{}'" to re-authenticate the manifest.
""").strip()
traceback = True
exit_mcode = 108


class ArchiveTAMRequiredError(TAMRequiredError):
__doc__ = textwrap.dedent("""
Archive '{}' is unauthenticated, but it is required for this repository.
""").strip()
traceback = True
exit_mcode = 106


class TAMInvalid(IntegrityError):
__doc__ = IntegrityError.__doc__
traceback = True
exit_mcode = 107

def __init__(self):
# Error message becomes: "Data integrity error: Manifest authentication did not verify"
Expand All @@ -108,6 +121,7 @@ def __init__(self):
class ArchiveTAMInvalid(IntegrityError):
__doc__ = IntegrityError.__doc__
traceback = True
exit_mcode = 105

def __init__(self):
# Error message becomes: "Data integrity error: Archive authentication did not verify"
Expand All @@ -117,6 +131,7 @@ def __init__(self):
class TAMUnsupportedSuiteError(IntegrityError):
"""Could not verify manifest: Unsupported suite {!r}; a newer version is needed."""
traceback = True
exit_mcode = 109


class KeyBlobStorage:
Expand Down
Loading

0 comments on commit d45fb61

Please sign in to comment.