RequireSudo

Error v101 → current 12.0

The operation requires sudo privileges, but the sender is not the sudo key.

Encountered by: validatorsdevelopers

Why This Error Exists

Sudo operations are the most privileged actions on a Substrate chain. Only the designated sudo key can execute them. This error is a security feature - it prevents unauthorized accounts from using administrative powers. If you're getting this error, you're either not the admin, or something changed about who the admin is.

Deep Dive

The Sudo pallet checks origin against the stored Key value. If Key is Some(X) and the caller is not X, RequireSudo fires. If Key is None (sudo removed), ALL sudo calls fail with this error. The check happens at the very start of sudo functions - no partial execution occurs.

Debugging Example

You call sudo(call=set_code(wasm)). Error: RequireSudo. Your account is 5Abc.... Query Sudo.Key - returns Some(5Xyz...). The sudo key is 5Xyz..., not your account. Either you need to sign with the 5Xyz... account, or you're not authorized for this operation.

Prevention Tips

  • Always query Sudo.Key before attempting sudo operations
  • Subscribe to KeyChanged events to track sudo key rotation
  • If building admin tools, verify Key matches before exposing sudo UI
  • Consider that sudo may be removed in production networks

From Chain Metadata

Sender must be the Sudo account

What This Means

The operation requires sudo privileges, but the sender is not the sudo key.

Common Causes

  • Calling sudo, sudo_as, set_key, or remove_key from a non-sudo account
  • The sudo key was recently changed and you're using the old key
  • The sudo key was removed (sudo is disabled)
  • Using the wrong wallet/account to sign the transaction

How to Fix

  • Query Sudo.Key to verify the current sudo account
  • Ensure you're signing with the correct account (the sudo key)
  • If sudo was removed, the operation is impossible - find alternative governance
  • Check if the sudo key recently changed and update your configuration

Storage to Check

Runtime Info

Pallet Index
12
Error Index
0
Error Code
12.0
Runtime Version
v393