itsfatduck/optimizerDuck · error · StepExecutionException

RevertDataUnknownType (localized via ServiceStrings.Format…

Error message

RevertDataUnknownType (localized via ServiceStrings.Format, formatted with rawType)

What it means

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.

Solutions

  1. Update the app to the version that wrote the revert file so the step type is registered again, then re-run the revert
  2. 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
  3. 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
  4. 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
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at optimizerDuck/Services/Revert/RevertManager.cs:739 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of itsfatduck/optimizerDuck@36acf585ae (2026-09-13). Data as JSON: /api/errors/abcf31d4dab02c19. Report an issue: GitHub.

Appendix: source

Thrown at optimizerDuck/Services/Revert/RevertManager.cs:739

    /// <summary>
    ///     Placeholder for persisted data whose step type is not registered
    ///     (downgrade, removed plugin). Fails loudly at revert time instead
    ///     of vanishing silently, and round-trips the raw payload so a
    ///     future version can still read it.
    /// </summary>
    private sealed class CorruptedStep(string rawType, JObject rawData) : IRevertStep
    {
        public string Type => rawType;

        public string Description =>
            Services.Optimization.Providers.ServiceStrings.Format(
                Services.Optimization.Providers.ServiceStrings.RevertDataUnloadableDescription,
                rawType
            );

        public Task<bool> ExecuteAsync(ShellService _, ILogger logger)
        {
            throw new StepExecutionException(
                Services.Optimization.Providers.ServiceStrings.Format(
                    Services.Optimization.Providers.ServiceStrings.RevertDataUnknownType,
                    rawType
                ),
                null
            );
        }

        public JObject ToData()
        {
            return rawData;
        }
    }
}

View on GitHub (pinned to 36acf585ae)