{"record":{"id":"b1d5c69808fc04dc","repo":"microsoft/garnet","slug":"unknown-aof-header-operation-type-header-optype","errorCode":null,"errorMessage":"Unknown AOF header operation type {header.opType}","messagePattern":"Unknown AOF header operation type (.+?)","errorType":"exception","errorClass":"GarnetException","httpStatus":null,"severity":"critical","filePath":"libs/server/AOF/AofProcessor.cs","lineNumber":502,"sourceCode":"                    ObjectStoreRMW(preparedParameters, objectContext, ref replayContext.parseState, bufferPtr, bufferLength, legacyCmdFormat);\n                    break;\n                case AofEntryType.ObjectStoreDelete:\n                    ObjectStoreDelete(preparedParameters, objectContext);\n                    break;\n                case AofEntryType.UnifiedStoreStringUpsert:\n                    UnifiedStoreStringUpsert(preparedParameters, unifiedContext, ref replayContext.parseState, bufferPtr, bufferLength, legacyCmdFormat);\n                    break;\n                case AofEntryType.UnifiedStoreRMW:\n                    UnifiedStoreRMW(preparedParameters, unifiedContext, ref replayContext.parseState, bufferPtr, bufferLength, legacyCmdFormat);\n                    break;\n                case AofEntryType.UnifiedStoreObjectUpsert:\n                    UnifiedStoreObjectUpsert(preparedParameters, unifiedContext, storeWrapper.GarnetObjectSerializer, bufferPtr, bufferLength);\n                    break;\n                case AofEntryType.UnifiedStoreDelete:\n                    UnifiedStoreDelete(preparedParameters, unifiedContext, activeVectorManager, replayContext.respServerSession.storageSession);\n                    break;\n                default:\n                    throw new GarnetException($\"Unknown AOF header operation type {header.opType}\");\n            }\n\n            return true;\n        }\n\n        static void StoreUpsert<TStringContext>(PreparedParameters preparedParameters, TStringContext stringContext, ref SessionParseState parseState, bool legacyCmdFormat)\n            where TStringContext : ITsavoriteContext<FixedSpanByteKey, StringInput, StringOutput, long, MainSessionFunctions, StoreFunctions, StoreAllocator>\n        {\n            var curr = preparedParameters.PayloadPtr;\n            var value = PinnedSpanByte.FromLengthPrefixedPinnedPointer(curr);\n            curr += value.TotalSize;\n\n            var stringInput = new StringInput { parseState = parseState };\n            _ = stringInput.DeserializeFrom(curr);\n            if (legacyCmdFormat)\n                stringInput.header.cmd = LegacyRespCommand.FromV3(stringInput.header.cmd);\n\n            StringOutput output = default;","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/server/AOF/AofProcessor.cs#L484-L520","documentation":"Thrown by AofProcessor.ProcessAofRecordInternal in the operation-type dispatch switch when header.opType does not match any known AofEntryType (StoreUpsert, StoreRMW, StoreDelete, ObjectStoreUpsert, ObjectStoreRMW, ObjectStoreDelete, and the Unified* variants). This means the entry's operation-type byte is unrecognized — indicating corruption or data from a newer version that added a new entry type.","triggerScenarios":"During replay, the opType field of an AOF entry falls through all enumerated cases. This can happen if the AOF was written by a newer Garnet version that introduced a new AofEntryType, or if the entry is corrupted so the opType byte is garbage.","commonSituations":"Version skew between the writer and the replayer; bit-rot on the AOF device; a bug in serialization that wrote an invalid opType.","solutions":["Ensure the replaying Garnet build is >= the build that wrote the AOF (new AofEntryType values are additive).","Restore the data directory from a clean checkpoint+AOF backup.","If reproducible with known-good data, file a Garnet issue with the opType value and the entry hexdump.","Verify storage media health (check dmesg / SMART for disk errors)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { aofProcessor.ProcessAofRecordInternal(...); }\ncatch (GarnetException ex) when (ex.Message.Contains(\"Unknown AOF header operation type\"))\n{\n    logger.LogCritical(ex, \"Unrecognized AOF opType during replay; data may be from a newer/corrupt source.\");\n    throw;\n}","preventionTips":["Replay AOF data only on a Garnet build >= the writer's build.","Back up data before replay.","Check storage media for corruption."],"tags":["aof","data-corruption","replay","internal"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}