Follow this doc: https://docs.substrate.io/tutorials/v3/forkless-upgrades/#upgrade-the-runtime-1.

Scheduled and set_code show an error: ValidationDataNotAvailable.

Do I miss something? How to fix this error?

Try sudo schedule, sudoUncheckedWeight schedule, also ValidationDataNotAvailable too!

Ps: set_code without a schedule is a success.

2 Answers 2


This can happen in case you try to call the schedule_upgrade function during the on_initialize phase.

Unfortunately, this does not work since scheduling an upgrade requires parachain validation data be present. Validation data is submitted by the collator via an inherent. An inherent always comes after the on_initialize phase. This leads to the fact that an upgrade attempt made from the on_initialize phase will never succeed.


A few things here, I see you are testing this upgrade from a parachain. Runtime upgrades on parachains should follow the authorize + enact flow, as specified in here https://docs.substrate.io/how-to-guides/v3/parachains/runtime-upgrades/

Per my understanding what you are hitting is no surprise, as the relay must signal this upgrade - error triggered here. So what would make more sense in terms of scheduling an upgrade from the parachain side, would be scheduling the authorization of the upgrade, and enactment afterwards, not necessarily scheduled this one.

See @pepyakin answer to check why scheduler is messing with the signaling

  • 1
    Thanks a lot. I have tried to authorize + enact flow then runtime upgrades succeed. So, there are two more questions, 1. what's the difference between authorize + enact and Sudo + set_code, I see they are also calling the schedule_code_upgrade(code) to do the same things. 2. how to “schedule a runtime upgrade after N blocknum”? tried but failed. (authorize + scheduleAfter enact).
    – Bart Yang
    May 2, 2022 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.