{"record":{"id":"0392dcc3fd427933","repo":"microsoft/FASTER","slug":"invalid-enum-argument-versionchangestatemachine","errorCode":null,"errorMessage":"Invalid Enum Argument","messagePattern":"Invalid Enum Argument","errorType":"exception","errorClass":"FasterException","httpStatus":null,"severity":"error","filePath":"cs/src/core/Index/Synchronization/VersionChangeStateMachine.cs","lineNumber":154,"sourceCode":"        /// <inheritdoc />\n        public override SystemState NextState(SystemState start)\n        {\n            var nextState = SystemState.Copy(ref start);\n            switch (start.Phase)\n            {\n                case Phase.REST:\n                    nextState.Phase = Phase.PREPARE;\n                    break;\n                case Phase.PREPARE:\n                    nextState.Phase = Phase.IN_PROGRESS;\n                    SetToVersion(targetVersion == -1 ? start.Version + 1 : targetVersion);\n                    nextState.Version = ToVersion();\n                    break;\n                case Phase.IN_PROGRESS:\n                    nextState.Phase = Phase.REST;\n                    break;\n                default:\n                    throw new FasterException(\"Invalid Enum Argument\");\n            }\n\n            return nextState;\n        }\n    }\n}","sourceCodeStart":136,"sourceCodeEnd":160,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/src/core/Index/Synchronization/VersionChangeStateMachine.cs#L136-L160","documentation":"VersionChangeStateMachine.NextState computes the next state of the FASTER version change protocol (used by ShiftLogicalAddress / blocking version management). Its switch advances PREPARE -> IN_PROGRESS -> REST; any other Phase hits the default branch and throws this exception. This is an internal exhaustive-switch guard, not a validation of user input.","triggerScenarios":"Phase corruption during a version change operation - e.g. interleaving blocking version advancement (NextVersion/ShiftLogicalAddress) with checkpoints or snapshots, or resuming with corrupted versionInfo state after a crash.","commonSituations":"Application code manually driving version changes while background checkpointing runs; failed prior version change leaving versionInfo in a non-standard phase.","solutions":["Do not mix manual version management calls with checkpoint/snapshot state machines running concurrently; serialize them.","Restart the process to restore the REST phase, then retry the version change.","Report a FASTER bug with the exact call sequence if it reproduces deterministically."],"exampleFix":"// before\nfaster.NextVersion();\nawait faster.TakeCheckpointAsync(); // concurrent state machines\n// after\nfaster.NextVersion();\nfaster.CompletePending();\nawait faster.TakeCheckpointAsync(); // after version change settles","handlingStrategy":"try-catch","validationCode":"// Do not advance versions while a checkpoint state machine is running\nif (checkpointInProgress) throw new InvalidOperationException(\"Version change conflicts with active checkpoint.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    faster.NextVersion();\n}\ncatch (FasterException ex) when (ex.Message == \"Invalid Enum Argument\")\n{\n    logger.LogError(ex, \"Version change state machine in unknown phase; restart required\");\n    throw;\n}","preventionTips":["Serialize manual version management with checkpoint operations.","Complete pending work before NextVersion / ShiftLogicalAddress.","Restart from clean checkpoint state after crashes mid-version-change."],"tags":["faster","version-change","state-machine"],"backgroundTag":"invalid-enum-value","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}