Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2009-2010 Satoshi Nakamoto2// Copyright (c) 2009-present The Bitcoin Core developers3// Distributed under the MIT software license, see the accompanying4// file COPYING or http://www.opensource.org/licenses/mit-license.php.6#include <script/script_error.h>8#include <string>10std::string ScriptErrorString(const ScriptError serror)11{12switch (serror)13{14case SCRIPT_ERR_OK:15return "No error";16case SCRIPT_ERR_EVAL_FALSE:17return "Script evaluated without error but finished with a false/empty top stack element";18case SCRIPT_ERR_VERIFY:19return "Script failed an OP_VERIFY operation";20case SCRIPT_ERR_EQUALVERIFY:21return "Script failed an OP_EQUALVERIFY operation";22case SCRIPT_ERR_CHECKMULTISIGVERIFY:23return "Script failed an OP_CHECKMULTISIGVERIFY operation";24case SCRIPT_ERR_CHECKSIGVERIFY:25return "Script failed an OP_CHECKSIGVERIFY operation";26case SCRIPT_ERR_NUMEQUALVERIFY:27return "Script failed an OP_NUMEQUALVERIFY operation";28case SCRIPT_ERR_SCRIPT_SIZE:29return "Script is too big";30case SCRIPT_ERR_PUSH_SIZE:31return "Push value size limit exceeded";32case SCRIPT_ERR_OP_COUNT:33return "Operation limit exceeded";34case SCRIPT_ERR_STACK_SIZE:35return "Stack size limit exceeded";36case SCRIPT_ERR_SIG_COUNT:37return "Signature count negative or greater than pubkey count";38case SCRIPT_ERR_PUBKEY_COUNT:39return "Pubkey count negative or limit exceeded";40case SCRIPT_ERR_BAD_OPCODE:41return "Opcode missing or not understood";42case SCRIPT_ERR_DISABLED_OPCODE:43return "Attempted to use a disabled opcode";44case SCRIPT_ERR_INVALID_STACK_OPERATION:45return "Operation not valid with the current stack size";46case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION:47return "Operation not valid with the current altstack size";48case SCRIPT_ERR_OP_RETURN:49return "OP_RETURN was encountered";50case SCRIPT_ERR_UNBALANCED_CONDITIONAL:51return "Invalid OP_IF construction";52case SCRIPT_ERR_NEGATIVE_LOCKTIME:53return "Negative locktime";54case SCRIPT_ERR_UNSATISFIED_LOCKTIME:55return "Locktime requirement not satisfied";56case SCRIPT_ERR_SIG_HASHTYPE:57return "Signature hash type missing or not understood";58case SCRIPT_ERR_SIG_DER:59return "Non-canonical DER signature";60case SCRIPT_ERR_MINIMALDATA:61return "Data push larger than necessary";62case SCRIPT_ERR_SIG_PUSHONLY:63return "Only push operators allowed in signatures";64case SCRIPT_ERR_SIG_HIGH_S:65return "Non-canonical signature: S value is unnecessarily high";66case SCRIPT_ERR_SIG_NULLDUMMY:67return "Dummy CHECKMULTISIG argument must be zero";68case SCRIPT_ERR_MINIMALIF:69return "OP_IF/NOTIF argument must be minimal";70case SCRIPT_ERR_SIG_NULLFAIL:71return "Signature must be zero for failed CHECK(MULTI)SIG operation";72case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS:73return "NOPx reserved for soft-fork upgrades";74case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM:75return "Witness version reserved for soft-fork upgrades";76case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION:77return "Taproot version reserved for soft-fork upgrades";78case SCRIPT_ERR_DISCOURAGE_OP_SUCCESS:79return "OP_SUCCESSx reserved for soft-fork upgrades";80case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE:81return "Public key version reserved for soft-fork upgrades";82case SCRIPT_ERR_PUBKEYTYPE:83return "Public key is neither compressed or uncompressed";84case SCRIPT_ERR_CLEANSTACK:85return "Stack size must be exactly one after execution";86case SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH:87return "Witness program has incorrect length";88case SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY:89return "Witness program was passed an empty witness";90case SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH:91return "Witness program hash mismatch";92case SCRIPT_ERR_WITNESS_MALLEATED:93return "Witness requires empty scriptSig";94case SCRIPT_ERR_WITNESS_MALLEATED_P2SH:95return "Witness requires only-redeemscript scriptSig";96case SCRIPT_ERR_WITNESS_UNEXPECTED:97return "Witness provided for non-witness script";98case SCRIPT_ERR_WITNESS_PUBKEYTYPE:99return "Using non-compressed keys in segwit";100case SCRIPT_ERR_SCHNORR_SIG_SIZE:101return "Invalid Schnorr signature size";102case SCRIPT_ERR_SCHNORR_SIG_HASHTYPE:103return "Invalid Schnorr signature hash type";104case SCRIPT_ERR_SCHNORR_SIG:105return "Invalid Schnorr signature";106case SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE:107return "Invalid Taproot control block size";108case SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT:109return "Too much signature validation relative to witness weight";110case SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG:111return "OP_CHECKMULTISIG(VERIFY) is not available in tapscript";112case SCRIPT_ERR_TAPSCRIPT_MINIMALIF:113return "OP_IF/NOTIF argument must be minimal in tapscript";114case SCRIPT_ERR_TAPSCRIPT_EMPTY_PUBKEY:115return "Empty public key in tapscript";116case SCRIPT_ERR_OP_CODESEPARATOR:117return "Using OP_CODESEPARATOR in non-witness script";118case SCRIPT_ERR_SIG_FINDANDDELETE:119return "Signature is found in scriptCode";120case SCRIPT_ERR_SCRIPTNUM:121return "Script number overflowed or is non-minimally encoded";122case SCRIPT_ERR_UNKNOWN_ERROR:123case SCRIPT_ERR_ERROR_COUNT:124break;125} // no default case, so the compiler can warn about missing cases126return "unknown error";127}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.