You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

遵循《将Pallet添加到Runtime》教程添加nicks Pallet后调用setName extrinsic失败问题排查咨询

Troubleshooting setName Failure with Nicks Pallet in Substrate Runtime

Hey there, let's walk through how to figure out why your setName extrinsic is failing with that system:ExtrinsicFailed error. The Module(index:9, error:0) code gives us a clear starting point—here are the key areas to check:

  • Map the error code to the Nicks pallet's specific issue
    First, confirm that module index 9 is assigned to the Nicks pallet in your construct_runtime! macro (that's where each pallet gets its unique index). Then, look at the Nicks pallet's Error enum—error code 0 is almost always the first variant, which for Nicks is typically InvalidName. This triggers if the name you're trying to set breaks the pallet's rules: maybe it's too long, contains invalid characters, or is empty. Double-check the name you're submitting against the pallet's MaxLength parameter and allowed character set.

  • Validate your Nicks pallet runtime configuration
    Make sure you've correctly set up the Nicks pallet's required traits in your runtime. Specifically:

    • The Currency type is properly linked to your runtime's currency pallet (Nicks needs this to hold the name deposit).
    • The ReservationCurrency is configured if you're using that feature.
    • The MaxLength parameter is set to a value that makes sense for your use case—if your name exceeds this length, the extrinsic will fail.
  • Check the signer's balance and extrinsic parameters
    The setName call requires a deposit to reserve funds from the signer's account. If the account you're using doesn't have enough free balance to cover this deposit, that could cause a failure (even if it's a different error code, it's worth ruling out). Also, double-check the name parameter you're passing: ensure it's not empty, and doesn't include any characters the pallet blocks (like whitespace or special symbols, depending on your setup).

  • Confirm your runtime build is up-to-date
    Sometimes cached builds can leave you running an outdated version of your runtime. Try running cargo clean to clear old build artifacts, then rebuild your node. Also, verify that the commit you referenced (with your Nicks pallet additions) is actually the version running on your node—you can check this via the system_version RPC call in Polkadot JS Apps.

  • Get a human-readable error message
    The raw error code doesn't tell the whole story. In Polkadot JS Apps, after the failed transaction, click on the error entry to expand it—you should see a human-friendly message that explicitly states why the extrinsic failed (like "Invalid name length" or "Insufficient balance"). You can also use the system_dispatchError RPC call to decode the error code into a readable format.

内容的提问来源于stack exchange,提问作者Larry Dixon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 18:17:34