Skip to content

Add more help when user submit incorrect or obsolete command line arguments.#9541

Open
gmatht wants to merge 7 commits intoborgbackup:masterfrom
gmatht:ux-clean4
Open

Add more help when user submit incorrect or obsolete command line arguments.#9541
gmatht wants to merge 7 commits intoborgbackup:masterfrom
gmatht:ux-clean4

Conversation

@gmatht
Copy link
Copy Markdown

@gmatht gmatht commented Mar 24, 2026

Description

Adds help when user submits incorrect or obsolete command line arguments.

For example on this branch error messages look like:

  • borg --repo /tmp/demo-repo init -e repokey-aes-ocb
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: argument : invalid choice: 'init' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
    Common fixes:
  • Maybe you meant repo-create not init:
    borg --repo /tmp/demo-repo repo-create -e repokey-aes-ocb
  • Run 'borg help' to list valid borg2 commands.
  • borg --repo /tmp/demo-repo rcreate -e repokey-aes-ocb
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: argument : invalid choice: 'rcreate' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
    Common fixes:
  • Maybe you meant repo-create not rcreate:
    borg --repo /tmp/demo-repo repo-create -e repokey-aes-ocb
  • Run 'borg help' to list valid borg2 commands.
  • borg repo-creat
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: argument : invalid choice: 'repo-creat' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
    Common fixes:
  • Maybe you meant repo-create not repo-creat:
    borg repo-create
  • Run 'borg help' to list valid borg2 commands.
  • borg repoo-list
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: argument : invalid choice: 'repoo-list' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
    Common fixes:
  • Maybe you meant repo-list not repoo-list:
    borg repo-list
  • Run 'borg help' to list valid borg2 commands.
  • borg --repo /tmp/demo-repo list --glob-archives 'my*'
    Common fixes:
  • borg1 option "--glob-archives" is not used in borg2. Use "--match-archives 'sh:PATTERN'" instead.
  • Example: borg list ARCHIVE --match-archives 'sh:old-'
    usage: borg [options] list [-h] [--critical] [--error] [--warning] [--info]
    [--debug] [--debug-topic TOPIC] [-p] [--iec]
    [--log-json] [--lock-wait SECONDS] [--show-version]
    [--show-rc] [--umask M] [--remote-path PATH]
    [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER]
    [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO] [--short]
    [--format FORMAT] [--json-lines] [--depth N]
    [-e PATTERN] [--exclude-from EXCLUDEFILE]
    [--pattern PATTERN] [--patterns-from PATTERNFILE]
    NAME [PATH ...]
    tip: For details of accepted options run: borg list --help
    error: argument NAME: Invalid archive name: "my
    " [invalid chars detected matching "/"<|>?*"]
  • borg --repo /tmp/demo-repo create --remote-ratelimit 1000 test /root/data
    Common fixes:
  • borg1 option "--remote-ratelimit" is not used in borg2. Use "--upload-ratelimit" instead.
    usage: borg [options] create [-h] [--critical] [--error] [--warning] [--info]
    [--debug] [--debug-topic TOPIC] [-p] [--iec]
    [--log-json] [--lock-wait SECONDS]
    [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER]
    [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO] [-n] [-s] [--list]
    [--filter STATUSCHARS] [--json]
    [--stdin-name NAME] [--stdin-user USER]
    [--stdin-group GROUP] [--stdin-mode M]
    [--content-from-command] [--paths-from-stdin]
    [--paths-from-command]
    [--paths-from-shell-command]
    [--paths-delimiter DELIM] [-e PATTERN]
    [--exclude-from EXCLUDEFILE] [--pattern PATTERN]
    [--patterns-from PATTERNFILE] [--exclude-caches]
    [--exclude-if-present NAME] [--keep-exclude-tags]
    [-x] [--numeric-ids] [--atime] [--noctime]
    [--nobirthtime] [--noflags] [--noacls]
    [--noxattrs] [--sparse] [--files-cache MODE]
    [--files-changed MODE] [--read-special]
    [--comment COMMENT] [--timestamp TIMESTAMP]
    [--chunker-params PARAMS] [-C COMPRESSION]
    [--hostname HOSTNAME] [--username USERNAME]
    [--tags TAG [TAG ...]]
    NAME [PATH ...]
    tip: For details of accepted options run: borg create --help
    error: Unrecognized arguments: --remote-ratelimit
  • borg --repo /tmp/demo-repo repo-create
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: Option 'repo-create.encryption' is required but not provided or its value is None.
    Use -e/--encryption to choose a mode, for example: -e repokey-aes-ocb
    Available encryption modes: none, authenticated, authenticated-blake2, keyfile-aes-ocb, repokey-aes-ocb, keyfile-chacha20-poly1305, repokey-chacha20-poly1305, keyfile-blake2-aes-ocb, repokey-blake2-aes-ocb, keyfile-blake2-chacha20-poly1305, repokey-blake2-chacha20-poly1305

  • borg --repo /tmp/demo-repo::test1 list
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: argument -r/--repo: Invalid location format: "/tmp/demo-repo::test1".

Common fixes:

  • Borg 2 does not accept repo::archive syntax. Corrected command lines:
    borg list --repo /tmp/demo-repo list ::test1
    OR
    export BORG_REPO=/tmp/demo-repo
    borg list ::test1
  • borg --repo /tmp/does-not-exist repo-info
    Repository /tmp/does-not-exist does not exist.
    Common fixes:
  • Specify Correct Path ("/tmp/does-not-exist" does not exist).
  • Create repository (-r): borg repo-create -r "/tmp/does-not-exist" -e repokey-aes-ocb
  • Create repository (BORG_REPO):
    export BORG_REPO=/tmp/does-not-exist
    borg repo-create -e repokey-aes-ocb
    Available -e modes: none, authenticated, authenticated-blake2, keyfile-aes-ocb, repokey-aes-ocb, keyfile-chacha20-poly1305, repokey-chacha20-poly1305, keyfile-blake2-aes-ocb, repokey-blake2-aes-ocb, keyfile-blake2-chacha20-poly1305, repokey-blake2-chacha20-poly1305
  • borg --repo /tmp/does-not-exist list
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: Option 'list.paths' is required but not provided or its value is None.

Common fixes:

  • "/tmp/does-not-exist" does not exist, pick a repository that exists or create one:
    borg repo-create --repo /tmp/does-not-exist -e repokey-aes-ocb
    Available -e modes: none, authenticated, authenticated-blake2, keyfile-aes-ocb, repokey-aes-ocb, keyfile-chacha20-poly1305, repokey-chacha20-poly1305, keyfile-blake2-aes-ocb, repokey-blake2-aes-ocb, keyfile-blake2-chacha20-poly1305, repokey-blake2-chacha20-poly1305
  • borg list
    usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
    [--critical] [--error] [--warning] [--info] [--debug]
    [--debug-topic TOPIC] [-p] [--iec] [--log-json]
    [--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
    [--remote-path PATH] [--upload-ratelimit RATE]
    [--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
    [--socket [PATH]] [-r REPO]
    ...
    tip: For details of accepted options run: borg --help
    error: Option 'list.paths' is required but not provided or its value is None.
    borg list requires an archive NAME to list contents.
    Common fixes:
  • Provide archive name: borg list NAME
  • To list archives in a repository, use: borg -r REPO repo-list

Checklist

  • [ X] PR is against master (or maintenance branch if only applicable there)
  • [ X] New code has tests and docs where appropriate
  • [ X] Tests pass (run tox or the relevant test subset)
  • [ X] Commit messages are clean and reference related issues

gmatht and others added 6 commits March 25, 2026 04:09
When --repo uses legacy repo::archive syntax, show list and repo-info style examples.
Replace useless repo-info bullet with path reasons; add InvalidRepository guidance; get_message returns full text.
Invalid subcommand synonyms/fuzzy hints, argv-based examples, Common fixes for repo::archive and flags before subcommand, repo-create encryption reminder.
preprocess_args: glob-archives and related hints with example; omit Rust version branding.
Add cli_guidance and argparsing hint tests; adjust repository remote tests; manual UX smoke script.
@ThomasWaldmann
Copy link
Copy Markdown
Member

@gmatht Thanks for the PR and working on this.

I think this first needs an ISSUE being filed with a description of the problem.

You can then refer to that issue from this PR comment (or from a commit comment) using ", fixes #XXXX".

The PR comment as it is now (wall of text) is not acceptable.

@ThomasWaldmann
Copy link
Copy Markdown
Member

Some more feedback:

  • keep the canary, I want to know if something breaks for master
  • remove the phantasy commands and mis-spellings. it is fine to support users coming from borg 1.x, but we do not need to try fixing random typos and commands borg never had.
  • in general, keep this rather to the minimum.

@gmatht
Copy link
Copy Markdown
Author

gmatht commented May 8, 2026

As is the canary in master isn't very useful as rorg was a back-of-the-envelope port of Borg to rust. The outcome seemed to be that moving from sequential to Rayon helped a lot, but for whatever reason my Rust was slower single threaded than your Cython. I doubt you'll care what that breaks since you are unlikely to want to merge that.

I guess I could move the experimental work into a branch and only put potentially merge worthy commits into master.

Also, should I break up the commits by the subheadings above e.g. commit -m 'Extra help: Borg1 init used on Borg2'?

@ThomasWaldmann
Copy link
Copy Markdown
Member

Sorry, I have a hard time parsing your answer. This is a PR to borg (not rorg) and we want the canary here.

Also, this is way too much and should be limited to "valid borg 1.x command" -> borg2 help.

It does not even need to cover all command/option changes, the most popular ones would be good enough. If somebody uses something rare, they can also just read the docs.

@gmatht
Copy link
Copy Markdown
Author

gmatht commented May 8, 2026

Ah I see. I tried to disable the canary on the rorg master but somehow it seems to have been appended to this pull request instead.

FYI, My understanding was that this pull request was denied, and that I should flesh out what is actually required on the related Issue instead. (And then issue a pull request for only the simpler commits for the suggested features).
#9545

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants