It turns out my password also wasn't accepted using
sshpass on Debian 11 running openssh-server
I had a look at the logs and could verify that the server is indeed waiting for the password to be entered.
The password prompt looks like this without
$ sftp -oStrictHostKeyChecking=no -i ./id_rsa me@thething
Enter passphrase for key './id_rsa':
Looking at the man page of sshpass, I found this option:
-P Set the password prompt. Sshpass searched for this prompt in the program's
output to the TTY as an indication when to send the password. By default
sshpass looks for the string "assword:" (which matches both "Password:" and
"password:"). If your client's prompt does not fall under either of these,
you can override the default with this option.
-P and a matching keyword solved it.
$ echo "cd Downloads" | SSHPASS=testpass sshpass -P 'passphrase' -e sftp -oStrictHostKeyChecking=no -i ./id_rsa me@thething
Connected to thething.
sftp> cd Downloads