What does Windows error code 1021 (ERROR_CHILD_MUST_BE_VOLATILE) mean?

 
Previous Next
ERROR_KEY_HAS_CHILDREN ERROR_NOTIFY_ENUM_DIR

ERROR_CHILD_MUST_BE_VOLATILE

A stable registry key cannot be created under a volatile parent

RegCreateKeyEx can create a key with REG_OPTION_VOLATILE, which keeps the information in memory instead of preserving it when the corresponding hive is unloaded. Windows enforces the lifetime relationship between that volatile parent and its descendants. This error reports an attempt to introduce persistent child state beneath a parent whose own lifetime is temporary.

Trace the options used when the parent and child keys were created. The usual defect is a helper that always creates persistent keys even when called under a volatile runtime subtree. Decide whether the child is runtime state and should also be volatile, or whether the data must survive and belongs under a persistent parent. Changing only the child flag without reviewing the intended lifetime can hide a design mismatch and cause configuration to disappear at reboot or hive unload.

What to inspect

  • Record REG_OPTION_* flags for creation of both parent and child.
  • Choose volatility from the intended lifetime of the entire subtree.
  • Move persistent configuration to a persistent parent instead of mixing lifetimes.

References


Looking for a different code? Search another status or error code.