{"record":{"id":"e0662155374e6f75","repo":"itsfatduck/optimizerDuck","slug":"registry-verify-failed-at-path-name-expected-absent-actual","errorCode":null,"errorMessage":"Registry verify failed at {Path}:{Name}: expected '<absent>', actual '{actual}'","messagePattern":"Registry verify failed at (.+?):(.+?): expected '<absent>', actual '(.+?)'","errorType":"exception","errorClass":"StepExecutionException","httpStatus":null,"severity":"error","filePath":"optimizerDuck/Domain/Revert/Steps/RegistryRevertStep.cs","lineNumber":286,"sourceCode":"                break;\n            }\n            case RevertAction.NoPreviousValue:\n            case RevertAction.RestorePrevious:\n            {\n                // a failed read is not \"absent\".\n                if (\n                    !RegistryService.TryReadValue(\n                        new RegistryItem(Path, Name!),\n                        out var actual,\n                        call.Logger\n                    )\n                )\n                    throw new StepExecutionException(\n                        $\"Registry verify failed at {Path}:{Name}: could not read the value.\",\n                        null\n                    );\n                if (actual != null)\n                    throw new StepExecutionException(\n                        $\"Registry verify failed at {Path}:{Name}: expected '<absent>', actual '{actual}'\",\n                        null\n                    );\n                break;\n            }\n            case RevertAction.RestoreKey:\n                if (\n                    !RegistryService.TryKeyExists(\n                        new RegistryItem(Path),\n                        out var restoreExists,\n                        call.Logger\n                    )\n                )\n                    throw new StepExecutionException(\n                        $\"Registry verify failed at {Path}: could not query the key.\",\n                        null\n                    );\n                if (!restoreExists)","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/itsfatduck/optimizerDuck/blob/36acf585ae122a09f0e29eb4acedfaf94e81c0de/optimizerDuck/Domain/Revert/Steps/RegistryRevertStep.cs#L268-L304","documentation":"Thrown by VerifyRestore when, after deleting a registry value (NoPreviousValue or RestorePrevious with null Value), the value still reads back as present. The revert write succeeded per the provider, but the value reappears on verification.","triggerScenarios":"DeleteValue executed on {Path}:{Name} but TryReadValue returns non-null actual — deletion was denied but reported ok, another process recreated the value between delete and verify, or a different registry view (WOW64) holds a same-named value.","commonSituations":"Group policy or a background service re-creating the value; ACLs preventing deletion while reads still succeed; the optimization had created the value in a redirected WOW6432Node path while verification reads the 64-bit view.","solutions":["Re-run the revert elevated so DeleteValue actually succeeds.","Identify and stop the process recreating the value (Process Monitor) before reverting.","Verify you are deleting the same registry view where the value lives (check WOW6432Node).","Delete the value manually in regedit and remove the revert file."],"exampleFix":"// before\nif (actual != null)\n    throw new StepExecutionException($\"...expected '<absent>', actual '{actual}'\", null);\n// after: one retry of the delete before failing\nif (actual != null)\n{\n    RegistryService.DeleteValue(opCall, new RegistryItem(Path, Name!));\n    RegistryService.TryReadValue(new RegistryItem(Path, Name!), out actual, call.Logger);\n    if (actual != null) throw new StepExecutionException($\"...expected '<absent>', actual '{actual}'\", null);\n}","handlingStrategy":"retry","validationCode":"// ensure no writer holds the key before delete\nbool valuePresent = RegistryService.KeyExists(new RegistryItem(step.Path));\nlogger.LogInformation(\"Pre-revert key presence at {Path}: {Present}\", step.Path, valuePresent);","typeGuard":"bool IsValueDeletion(RegistryRevertStep s) => s.Action is RevertAction.NoPreviousValue or RevertAction.RestorePrevious && s.Value == null;","tryCatchPattern":"for (int attempt = 0; attempt < 2; attempt++)\n{\n    try { await step.ExecuteAsync(shell, logger); break; }\n    catch (StepExecutionException ex) when (ex.Message.Contains(\"expected '<absent>'\") && attempt == 0)\n    {\n        logger.LogWarning(\"Value still present; retrying delete once\");\n    }\n}","preventionTips":["Stop the service/app that recreates the value before reverting.","Run elevated so DeleteValue genuinely succeeds.","Verify the value's registry view (WOW64) matches the one the app deletes."],"tags":["registry","verify","revert","delete"],"backgroundTag":"unexpected-response-shape","analyzedSha":"36acf585ae122a09f0e29eb4acedfaf94e81c0de","analyzedAt":"2026-09-13T08:30:13.845Z","contentChangedAt":"2026-09-13T08:30:13.845Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}