> Conclusion: the problem is fixed im Emacs' master branch. Unfortunately,
> this fix is not in Tramp itself, so it doesn't suffices to use a recent
> Tramp version from ELPA.
Many thanks for the rapid confirmation diagnosis.
I have a question: presumably the latest version of TRAMP still generates empty completion-read candidates. I think the question still needs answering: is this valid? If not, then whatever has changed in Emacs 31 is just masking a bug that still exists in TRAMP.