itsfatduck/optimizerDuck · error · StepExecutionException
Registry verify failed at
Error message
Registry verify failed at {Path}: expected key to exist, but it was missing What it means
Post-revert verification failure in RegistryRevertStep.VerifyRestore for a RestoreKey action: after restoring a deleted key tree, the code re-checks registry existence via RegistryService.TryKeyExists and the key that should have been recreated is still missing. This means the restore operation reported success but its effect is not observable in the registry — typically because the restore write silently failed, was rolled back, or another process removed the key between restore and verify. Fail-closed: the step refuses to claim success it cannot confirm.
Solutions
- Re-run the revert elevated to avoid registry virtualization redirection.
- Check whether the key exists under WOW6432Node and correct the stored Path.
- Find what deleted the key (Process Monitor) and stop it before reverting.
- Recreate the key manually and delete the revert file.
Example fix
// before
if (!restoreExists)
throw new StepExecutionException($"Registry verify failed at {Path}: expected key to exist, but it was missing", null);
// after: recreate once before failing
if (!restoreExists)
{
RegistryService.CreateSubKey(opCall, new RegistryItem(Path));
RegistryService.TryKeyExists(new RegistryItem(Path), out restoreExists, call.Logger);
if (!restoreExists) throw new StepExecutionException($"...expected key to exist, but it was missing", null);
} Defensive patterns
Strategy: retry
Validate before calling
// check both views before concluding the key is missing
bool exists64 = RegistryService.KeyExists(new RegistryItem(path));
bool exists32 = RegistryService.KeyExists(new RegistryItem(path.Replace("\\Software\\", "\\Software\\WOW6432Node\\"))); Type guard
bool IsKeyRestoreMissing(StepExecutionException ex) => ex.Message.Contains("expected key to exist, but it was missing"); Try / catch
try { await step.ExecuteAsync(shell, logger); }
catch (StepExecutionException ex) when (ex.Message.Contains("it was missing"))
{
logger.LogWarning("Key vanished after create; retrying restore once");
await step.ExecuteAsync(shell, logger);
} Prevention
- Run elevated to avoid registry virtualization redirecting CreateSubKey.
- Confirm bitness consistency between the applying process and verification.
- Investigate cleanup tools/AV that remove freshly created keys.
When it happens
Trigger: CreateSubKey(Path) returned Ok, but TryKeyExists(Path) finds no key: the key was deleted between create and verify, or the write landed in a different registry view (WOW64 redirection) than the one queried.
Common situations: Another process or cleanup routine removing the freshly created key; 32-bit vs 64-bit view mismatch (CreateSubKey wrote to WOW6432Node while verify checks the 64-bit path); virtualization (registry virtualization for non-elevated writes) silently redirecting the key.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Registry verify failed at
- Registry verify failed at
- Registry verify failed at
- Registry verify failed at
- Registry verify failed at
AI-assisted analysis of itsfatduck/optimizerDuck@36acf585ae (2026-09-13).
Data as JSON: /api/errors/cc80595f91e7eba8.
Report an issue: GitHub.
Appendix: source
Thrown at optimizerDuck/Domain/Revert/Steps/RegistryRevertStep.cs:305
$"Registry verify failed at {Path}:{Name}: expected '<absent>', actual '{actual}'",
null
);
break;
}
case RevertAction.RestoreKey:
if (
!RegistryService.TryKeyExists(
new RegistryItem(Path),
out var restoreExists,
call.Logger
)
)
throw new StepExecutionException(
$"Registry verify failed at {Path}: could not query the key.",
null
);
if (!restoreExists)
throw new StepExecutionException(
$"Registry verify failed at {Path}: expected key to exist, but it was missing",
null
);
break;
case RevertAction.DeleteKey:
if (
!RegistryService.TryKeyExists(
new RegistryItem(Path),
out var deleteExists,
call.Logger
)
)
throw new StepExecutionException(
$"Registry verify failed at {Path}: could not query the key.",
null
);
if (deleteExists)
throw new StepExecutionException(View on GitHub (pinned to 36acf585ae)