I got this error message while trying to decrypt a (symmetrically encrypted) file on OS X (macOS Sierra 10.12.4). The solution was to add the --pinentry-mode loopback option
bla$ gpg -d ciphertext.gpg gpg: AES encrypted data gpg: problem with the agent: No pinentry gpg: encrypted with 1 passphrase gpg: decryption failed: No secret key bla$ gpg
source share