microsoft/garnet · critical · GarnetException

Unsupported header type: {headerType}

Error message

Unsupported header type: {headerType}

What it means

Thrown by AofProcessor.GetSynchronizedOperationParams when extracting sequence number and participant count from a transaction header whose AofHeaderType is not one of the four known values (BasicHeader, ShardedHeader, SingleLogTransactionHeader, ShardedLogTransactionHeader). The method dispatches on headerType to determine how ordering (sequence number vs. log address) and participant count are read.

Source

Thrown at libs/server/AOF/AofProcessor.cs:219

                case AofHeaderType.SingleLogTransactionHeader:
                    sequenceNumber = entryAddress;
                    participantCount = (*(AofSingleLogTransactionHeader*)ptr).participantCount;
                    break;
                case AofHeaderType.ShardedLogTransactionHeader:
                    var txnHeader = *(AofShardedLogTransactionHeader*)ptr;
                    sequenceNumber = txnHeader.shardedHeader.sequenceNumber;
                    participantCount = txnHeader.participantCount;
                    break;
                case AofHeaderType.BasicHeader:
                    sequenceNumber = entryAddress;
                    participantCount = (short)storeWrapper.serverOptions.AofReplayTaskCount;
                    break;
                case AofHeaderType.ShardedHeader:
                    sequenceNumber = (*(AofShardedHeader*)ptr).sequenceNumber;
                    participantCount = (short)storeWrapper.serverOptions.AofReplayTaskCount;
                    break;
                default:
                    throw new GarnetException($"Unsupported header type: {headerType}");
            }
        }

        /// <summary>
        /// Process AOF record internal
        /// NOTE: This method is shared between recover replay and replication replay
        /// </summary>
        /// <param name="virtualSublogIdx"></param>
        /// <param name="ptr"></param>
        /// <param name="length"></param>
        /// <param name="asReplica"></param>
        /// <param name="isCheckpointStart"></param>
        /// <param name="logAddressSequenceNumber"></param>
        public void ProcessAofRecordInternal(int virtualSublogIdx, byte* ptr, int length, bool asReplica, out bool isCheckpointStart, long logAddressSequenceNumber = 0)
        {
            var header = *(AofHeader*)ptr;

            // Reject entries written by a newer Garnet version (higher AOF header version) rather than

View on GitHub (pinned to 951b0fc683)

Solutions

  1. Confirm the AOF/checkpoint was created by the same or a compatible Garnet version.
  2. Restore the data store from a known-good checkpoint+AOF backup.
  3. Check for disk corruption on the volume hosting the AOF.
  4. Report as a Garnet bug if the data is known-good and reproducible, including the headerType value.
Defensive patterns

Strategy: try-catch

Try / catch

try { GetSynchronizedOperationParams(ptr, entryAddress, out var seq, out var count); }
catch (GarnetException ex)
{
    logger.LogCritical(ex, "Unrecognized header type during replay");
    throw;
}

Prevention

When it happens

Trigger: During AOF replay or replication replay, GetSynchronizedOperationParams receives a pointer to a header whose type field is outside the valid 0-3 range. This indicates a corrupt entry or a pointer that is not aligned to a real AOF header.

Common situations: Corrupted AOF segments; replaying data across an incompatible Garnet version that changed header semantics; a memory-alignment or pointer-advancement bug in the replay loop feeding a wrong offset.

Related errors


AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13). Data as JSON: /api/errors/9f763c1963f589d5. Report an issue: GitHub.