user43686: I've been playing with raw transactions and signed transaction and I've noticed that the error "Mandatory script verify flag failed" comes in two variations.

script failed on OP_EQUALVERIFY OP
Script evaluated without error but finished with a false/empty top stack element.

Now, it appears that error number one is given whenever I try to send a transaction with the wrong TXID or index number. 
The second error can appear when I provide the wrong signature.
But aren't both errors just variant of a failure in executing the OP_EQUALVERIFY? At what step of the evaluation each error is thrown and what can we make out of it?
I'll highly appreciate any pointer you might have. I really struggle here to differentiate the two.

user30396: I was facing the same issue while I was creating a raw transaction. I got the message: mandatory-script-verify-flag-failed 
(Script failed an OP_EQUALVERIFY operation)

I figure out that the issue behind is that I am signing with an erroneous key which wasn't related to the UTXO.
I had to backup the key tied to the UTXO address using dumpprivkey and sign with it.

user2306: 
But aren't both errors just variant of a failure in executing the OP_EQUALVERIFY? At what step of the evaluation each error is thrown and what can we make out of it?

No, they're different errors. There are two rules that must be satisifed here:

The hash of the public key must match a certain value. (A failure here means you have the wrong key, or no key.)
The signature must be valid for the message and public key. (OP_CHECKSIG does not error immediately. It returns 0, which causes the script to fail.)

There are other script errors, too. See this list: https://github.com/bitcoin/bitcoin/blob/master/src/script/script_error.cpp

43686: <p>I've been playing with raw transactions and signed transaction and I've noticed that the error "Mandatory script verify flag failed" comes in two variations.</p>

<ol>
<li>script failed on OP_EQUALVERIFY OP</li>
<li>Script evaluated without error but finished with a false/empty top stack element.</li>
</ol>

<p>Now, it appears that error number one is given whenever I try to send a transaction with the wrong TXID or index number. 
The second error can appear when I provide the wrong signature.</p>

<p>But aren't both errors just variant of a failure in executing the OP_EQUALVERIFY? At what step of the evaluation each error is thrown and what can we make out of it?</p>

<p>I'll highly appreciate any pointer you might have. I really struggle here to differentiate the two.</p>
 30396: <p>I was facing the same issue while I was creating a raw transaction. I got the message: mandatory-script-verify-flag-failed </p>

<pre><code>(Script failed an OP_EQUALVERIFY operation)
</code></pre>

<p>I figure out that the issue behind is that I am signing with an erroneous key which wasn't related to the UTXO.
I had to backup the key tied to the UTXO address using dumpprivkey and sign with it.</p>
 2306: <blockquote>
  <p>But aren't both errors just variant of a failure in executing the OP_EQUALVERIFY? At what step of the evaluation each error is thrown and what can we make out of it?</p>
</blockquote>

<p>No, they're different errors. There are two rules that must be satisifed here:</p>

<ol>
<li>The hash of the public key must match a certain value. (A failure here means you have the wrong key, or no key.)</li>
<li>The signature must be valid for the message and public key. (<code>OP_CHECKSIG</code> does not error immediately. It returns 0, which causes the script to fail.)</li>
</ol>

<p>There are other script errors, too. See this list: <a href="https://github.com/bitcoin/bitcoin/blob/master/src/script/script_error.cpp" rel="noreferrer">https://github.com/bitcoin/bitcoin/blob/master/src/script/script_error.cpp</a></p>
