Try unlocking the wallet using walletpassphrase first.
If the wallet was locked, the error message would be:
$ /opt/bitcoin/bin/bitcoin-cli dumpprivkey 3CZELpSSQMiyd3QHVxnrF968ksL5AAAAAA
error code: -13
error message:
Error: Please enter the wallet passphrase with walletpassphrase first.
When type "dumpprivkey (address) " at console window at qt program,
If error message shows like
--------
Private key for address (address) is not known (code -4)
--------
What this means?
How can I fix this?
It seems the wallet doesn't know the private key of given address. You won't be able to spend coins of this address without importing its private key first.
Are you sure the address is correct and the wallet is supposed to know the private key ? Because it doesn't.
$ /opt/bitcoin/bin/bitcoin-cli dumpprivkey 3CZELpSSQMiyd3QHVxnrF968ksL5AAAAAA
error code: -13
error message:
Error: Please enter the wallet passphrase with walletpassphrase first.
$ /opt/bitcoin/bin/bitcoin-cli walletpassphrase "bitcoinROX" 3600
# The address is known:
$ /opt/bitcoin/bin/bitcoin-cli dumpprivkey 3CZE[...redacted...]yPLA
L5[...redacted...]Bo
# The address is not known:
$ /opt/bitcoin/bin/bitcoin-cli dumpprivkey 3G73[...redacted...]WUUV
error code: -3
error message:
Address does not refer to a key
(The message is not the same because I guess you're using an old fork, isn't it ?)