{"record":{"id":"abcf31d4dab02c19","repo":"itsfatduck/optimizerDuck","slug":"revertdataunknowntype-localized-via-servicestrings-format","errorCode":null,"errorMessage":"RevertDataUnknownType (localized via ServiceStrings.Format, formatted with rawType)","messagePattern":"RevertDataUnknownType \\(localized via ServiceStrings\\.Format, formatted with rawType\\)","errorType":"exception","errorClass":"StepExecutionException","httpStatus":null,"severity":"error","filePath":"optimizerDuck/Services/Revert/RevertManager.cs","lineNumber":739,"sourceCode":"    /// <summary>\n    ///     Placeholder for persisted data whose step type is not registered\n    ///     (downgrade, removed plugin). Fails loudly at revert time instead\n    ///     of vanishing silently, and round-trips the raw payload so a\n    ///     future version can still read it.\n    /// </summary>\n    private sealed class CorruptedStep(string rawType, JObject rawData) : IRevertStep\n    {\n        public string Type => rawType;\n\n        public string Description =>\n            Services.Optimization.Providers.ServiceStrings.Format(\n                Services.Optimization.Providers.ServiceStrings.RevertDataUnloadableDescription,\n                rawType\n            );\n\n        public Task<bool> ExecuteAsync(ShellService _, ILogger logger)\n        {\n            throw new StepExecutionException(\n                Services.Optimization.Providers.ServiceStrings.Format(\n                    Services.Optimization.Providers.ServiceStrings.RevertDataUnknownType,\n                    rawType\n                ),\n                null\n            );\n        }\n\n        public JObject ToData()\n        {\n            return rawData;\n        }\n    }\n}\n","sourceCodeStart":721,"sourceCodeEnd":754,"githubUrl":"https://github.com/itsfatduck/optimizerDuck/blob/36acf585ae122a09f0e29eb4acedfaf94e81c0de/optimizerDuck/Services/Revert/RevertManager.cs#L721-L754","documentation":"Fail-loud sentinel from RevertManager.CorruptedStep.ExecuteAsync: the persisted revert JSON contains a step whose Type string is not in the reflection-based _stepRegistry, meaning the step class no longer exists (app downgrade, removed/renamed plugin step, or corrupted file). CorruptedStep is a placeholder substituted at deserialization time; instead of silently skipping the unknown step (which would lose undo data), it throws at revert time with a localized 'RevertDataUnknownType' message formatted with the raw type name, while round-tripping the raw JObject payload so a newer version can still interpret it.","triggerScenarios":"Thrown at optimizerDuck/Services/Revert/RevertManager.cs:739 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Update the app to the version that wrote the revert file so the step type is registered again, then re-run the revert","If downgrading intentionally, delete the stale revert file at %LocalAppData%\\optimizerDuck\\Revert\\{optimizationId}.json (accepting that the optimization stays applied) via ClearAllRevertData or manual removal","Inspect the revert JSON's steps array to identify the unknown type string and manually undo its effect (registry value, service startup type, scheduled task) if needed","Report the unknown type string to maintainers if it appears with a current app version — it may indicate a renamed step class needing a migration alias"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}