ExtrinsicFailed
Event Re-added v101 → v277, v290 → current #1Emitted when an extrinsic fails during execution.
View events on chainThe Big Picture
Transactions can fail for many reasons: insufficient balance, invalid parameters, rate limits, network conditions. ExtrinsicFailed tells you something went wrong and includes the error code. State changes are reverted, but you still pay fees (you used network resources even though the operation failed).
Why This Matters
If you assume success and it actually failed, your app is out of sync with reality. This event + the error code tells you what went wrong so you can fix it and retry. Common failures: insufficient balance, already registered, rate limited.
Example Scenario
You try to stake but ExtrinsicFailed fires with error 'NotEnoughBalanceToStake'. Your stake didn't happen. Check your available balance, then retry with an amount you can actually afford (including the transaction fee).
Common Questions
- Do I still pay fees if my transaction fails?
- Yes, for the computation used. You may get a partial refund if the failure was early, but don't count on it. Validate inputs before submitting to avoid waste.
- How do I find out what error happened?
- The dispatch_error field contains module index and error index. Look these up in the pallet's error list to get the specific error name and meaning.
Use Cases
- Detect and handle failed transactions
- Debug why operations didn't work
- Monitor network error rates
- Build retry logic for recoverable failures
How to Use This Event
- → Always check for this after submitting transactions
- → Parse the dispatch error to understand why it failed
- → Implement retry logic for transient failures
From Chain Metadata
An extrinsic failed.
Triggers
Preconditions
- Extrinsic encountered an error during dispatch
Effects
Postconditions
- State changes from failed extrinsic are reverted
Side Effects
- Transaction fees still deducted (partial refund possible)
- Error information available in dispatch error
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | dispatch_error | DispatchError | The error that caused the extrinsic to fail |
| 1 | dispatch_info | DispatchEventInfo | Information about the extrinsic dispatch |
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Subscribe to ExtrinsicFailed events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("System") &&
event.method === "ExtrinsicFailed"
)
.forEach(({ event }) => {
console.log("ExtrinsicFailed:", event.data.toHuman());
});
});On-Chain Activity
Protocol plumbing — fires on nearly every extrinsic
#4 most emitted event
As of block 7,429,232
Version History
Runtime Info
- Pallet Index
- 0
- Event Index
- 1
- First Version
- v101
- Current Version
- v393