user23121: I downloaded and ran bitcoin-qt to play around with.
First thing I did was create a wallet passphrase. 
The second thing I did was try to create a wallet backup.
Then I got this message:
Error: Wallet backup failed! (code -4)
If I simply delete the wallet file (no coins on it yet) and then restart bitcoin, everything works fine.  But if I try to encrypt the wallet and then create a backup I get the error again.
What am I missing?
>getinfo
{
"version" : 90300,
"protocolversion" : 70002,
"walletversion" : 60000,
"balance" : 0.00000000,
"blocks" : 340782,
"timeoffset" : -3,
"connections" : 8,
"proxy" : "",
"difficulty" : 41272873894.69702100,
"testnet" : false,
"keypoololdest" : 1422415118,
"keypoolsize" : 101,
"unlocked_until" : 1422419612,
"paytxfee" : 0.00000000,
"relayfee" : 0.00001000,
"errors" : ""
}

>backupwallet wallet.backup
Error: Wallet backup failed! (code -4)

When looking at the debug.log file I see this error:
2015-01-27 16:07:36 error copying wallet.dat to wallet.backup - boost::filesystem::copy_file: Access is denied: "C:\Users\Matthew\AppData\Roaming\Bitcoin\wallet.dat", "wallet.backup"


user2306: I've looked at Bitcoin's backupwallet code, and that error is triggered by a filesystem error. I can't tell what kind of filesystem error it is, though. Please open debug.log in the Bitcoin directory. There should be a line like
<date + time> error copying wallet.dat to <path> - <kind of error>

This is the most common type of error:
error copying wallet.dat to <dest> - boost::filesystem::copy_file: Access is denied: "<src>", "wallet.backup"

This means Bitcoin is trying to backup your wallet to C:\Program Files\Bitcoin. You don't have the permissions to backup there. To fix this, run 
backupwallet "C:\Users\<username>\AppData\Roaming\Bitcoin\wallet.backup"

instead.

23121: <p>I downloaded and ran bitcoin-qt to play around with.</p>

<p>First thing I did was create a wallet passphrase. </p>

<p>The second thing I did was try to create a wallet backup.</p>

<p>Then I got this message:
Error: Wallet backup failed! (code -4)</p>

<p>If I simply delete the wallet file (no coins on it yet) and then restart bitcoin, everything works fine.  But if I try to encrypt the wallet and then create a backup I get the error again.</p>

<p>What am I missing?</p>

<pre><code>&gt;getinfo
{
"version" : 90300,
"protocolversion" : 70002,
"walletversion" : 60000,
"balance" : 0.00000000,
"blocks" : 340782,
"timeoffset" : -3,
"connections" : 8,
"proxy" : "",
"difficulty" : 41272873894.69702100,
"testnet" : false,
"keypoololdest" : 1422415118,
"keypoolsize" : 101,
"unlocked_until" : 1422419612,
"paytxfee" : 0.00000000,
"relayfee" : 0.00001000,
"errors" : ""
}

&gt;backupwallet wallet.backup
Error: Wallet backup failed! (code -4)
</code></pre>

<p>When looking at the debug.log file I see this error:</p>

<pre><code>2015-01-27 16:07:36 error copying wallet.dat to wallet.backup - boost::filesystem::copy_file: Access is denied: "C:\Users\Matthew\AppData\Roaming\Bitcoin\wallet.dat", "wallet.backup"
</code></pre>
 2306: <p>I've looked at Bitcoin's <code>backupwallet</code> code, and that error is triggered by a filesystem error. I can't tell what kind of filesystem error it is, though. Please open debug.log in the Bitcoin directory. There should be a line like</p>

<pre><code>&lt;date + time&gt; error copying wallet.dat to &lt;path&gt; - &lt;kind of error&gt;
</code></pre>

<p>This is the most common type of error:</p>

<pre><code>error copying wallet.dat to &lt;dest&gt; - boost::filesystem::copy_file: Access is denied: "&lt;src&gt;", "wallet.backup"
</code></pre>

<p>This means Bitcoin is trying to backup your wallet to C:\Program Files\Bitcoin. You don't have the permissions to backup there. To fix this, run </p>

<pre><code>backupwallet "C:\Users\&lt;username&gt;\AppData\Roaming\Bitcoin\wallet.backup"
</code></pre>

<p>instead.</p>
