Shell completion not working with encrypted configuration

What is the problem you are having with rclone?

Shell completion does not work for me if I enable encryption of my config file with a password. I have confirmed that the completion works fine if I disable the config encryption, but as soon as I enable it again the shell completion stops working. I have tried to run the rclone __complete command manually and it still works, but you have to enter your configuration password before it returns anything. My suspicion is that this password prompt is messing up the autocomplete functionality. Is this intended or a bug? I can imagine that completion that requires info from the config, like names of remotes, doesn't work without the password with an encrypted config, but some completions, e.g. of commands or command-line options should work even without a password.

Run the command 'rclone version' and share the full output of the command.

rclone v1.74.1
- os/version: arch (64 bit)
- os/kernel: 7.0.5-arch1-1 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.26.3-X:nodwarf5
- go/linking: dynamic
- go/tags: none

I am running rclone within zsh, using the provided zsh completion script as distributed by the Arch Linux package.

Which cloud storage system are you using? (eg Google Drive)

Not relevant for this question.

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Not relevant for this question.

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

This only printed the configuration of my remotes, which shouldn't be relevant for this question.

A log from the command that you were trying to run with the -vv flag

The completion happens before running a command, so instead I'll copy an example of the log from the completion engine:

========= starting completion logic ==========
CURRENT: 2, words[*]: rclone arch
Truncated words[*]: rclone arch,
lastParam: arch, lastChar: h
About to call: eval rclone __complete arch
[Debug] ValidArgsFunction called with args=[] toComplete="arch"
[Debug] valid remote = false
completion output: 
last line: 
No directive found.  Setting do default
directive: 0
completions: 
flagPrefix: 
Calling _describe
_describe did not find completions.
Checking if we should do file completion.
Activating file completion

You can see that the output of the 'ValidArgsFunction' is empty, probably due to the password prompt.

That sounds like a real limitation of the completion path. The completion script is still invoking rclone, and once the config is encrypted rclone cannot list remotes or config-backed values without asking for the password. Static command/flag completion could theoretically work without config access, but the current flow seems to mix those paths. As a workaround, if this is on a trusted local machine, you can test whether exporting RCLONE_CONFIG_PASS before starting the shell makes completion behave normally. If it does, that is good evidence for a bug/feature request: static completions should not block on encrypted config, while remote-name completions probably have to.

Thanks for the reply. I did a quick test and if I export RCLONE_CONFIG_PASS then the shell completion indeed starts behaving normally again even with an encrypted config. I suppose this could be a workaround on a trusted local machine, but it would be useful if the static completions also work with encrypted configs without the workaround.