I create a database in KeePass2 and then can open it with kpcli using a password
I then make a key and password database in KeePass2 and save it. I open it with kpcli using kpcli --kdb=Database.kdbx --key=Database.key and enter my password. It says:
Couldn't load the file Database.kdbx
Error(s) from File::KeePass:
The database key appears invalid or else the database is corrupt.
I then reopen the database in KeePass2 with the key and password. It works fine.
I installed v3.6-1 from: https://aur.archlinux.org/packages/kpcli/
In the README file here: https://sourceforge.net/projects/kpcli/files/
You'll see:
Version 4 of the KDBX file format is unsupported
KeePass 2.35 introduced version 4 of the KDBX file format (KDBXv4) and it is unsupported by File::KeePass. File::KeePass can only decrypt databases encrypted with AES and newer KeePass versions offer ChaCha20, which will also save the file as KDBXv4. You can use the File -> Database Settings -> Security tab to change the encryption algorithm to AES/Rijndael and, as of KeePass 2.46, kpcli will be able to operate on the files. https://keepass.info/help/kb/kdbx_4.html
I suspect that is the issue that you are encountering, but I cannot be sure.
Thank you