{"record":{"id":"57d2c09291bd1c3a","repo":"microsoft/garnet","slug":"option-filetype-not-supported","errorCode":null,"errorMessage":"Option {fileType} not supported","messagePattern":"Option (.+?) not supported","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"libs/cluster/Server/Replication/CheckpointEntry.cs","lineNumber":96,"sourceCode":"        /// </summary>\n        /// <returns>(true) if operation succeeded, (false) otherwise</returns>\n        public bool TrySuspendReaders()\n            => _lock.IsWriteLocked || _lock.TryWriteLock();\n\n        /// <summary>\n        /// Compare tokens for specified CheckpointFileType\n        /// </summary>\n        /// <param name=\"entry\"></param>\n        /// <param name=\"fileType\"></param>\n        /// <returns>(true) if token is shared between entries, (false) otherwise</returns>\n        /// <exception cref=\"Exception\"></exception>\n        public bool ContainsSharedToken(CheckpointEntry entry, CheckpointFileType fileType)\n        {\n            return fileType switch\n            {\n                CheckpointFileType.STORE_HLOG => metadata.storeHlogToken.Equals(entry.metadata.storeHlogToken),\n                CheckpointFileType.STORE_INDEX => metadata.storeIndexToken.Equals(entry.metadata.storeIndexToken),\n                _ => throw new Exception($\"Option {fileType} not supported\")\n            };\n        }\n\n        /// <summary>\n        /// Serialize CheckpointEntry\n        /// </summary>\n        /// <returns></returns>\n        public byte[] ToByteArray()\n        {\n            var ms = new MemoryStream();\n            var writer = new BinaryWriter(ms, Encoding.ASCII);\n\n            // Write checkpoint entry data for main store\n            writer.Write(metadata.storeVersion);\n            writer.Write(metadata.storeHlogToken.ToByteArray());\n            writer.Write(metadata.storeIndexToken.ToByteArray());\n            metadata.storeCheckpointCoveredAofAddress.Serialize(writer);\n            writer.Write(metadata.storePrimaryReplId == null ? 0 : 1);","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/microsoft/garnet/blob/951b0fc6838721f89d102c2bbe1b914e8d39d700/libs/cluster/Server/Replication/CheckpointEntry.cs#L78-L114","documentation":"Thrown by CheckpointEntry.ContainsSharedToken when fileType is neither STORE_HLOG nor STORE_INDEX. The method compares only those two token kinds, so other CheckpointFileType values (e.g. STORE_SNAPSHOT, STORE_HLOG_OBJ) are unsupported for shared-token comparison.","triggerScenarios":"Calling ContainsSharedToken with a snapshot or object-log file type, or an out-of-range CheckpointFileType cast.","commonSituations":"A checkpoint-replication code path that asks to share a token for a snapshot file when only hlog/index tokens are tracked for sharing; extending checkpoint types without extending this comparison.","solutions":["Call ContainsSharedToken only for STORE_HLOG or STORE_INDEX file types.","If snapshot/object tokens need shared comparison, extend the switch with the relevant arms and token fields.","Guard the caller to skip or branch on unsupported file types rather than passing them through."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only compare shared tokens for supported file types\nif (fileType is not (CheckpointFileType.STORE_HLOG or CheckpointFileType.STORE_INDEX))\n    throw new ArgumentOutOfRangeException(nameof(fileType), fileType, \"Shared-token comparison supports STORE_HLOG/STORE_INDEX only\");\nreturn entryA.ContainsSharedToken(entryB, fileType);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict ContainsSharedToken callers to STORE_HLOG/STORE_INDEX.","Extend the switch (and token fields) when adding file types that need shared comparison.","Document supported file types on the method."],"tags":["cluster","replication","checkpoint","enum-switch","garnet"],"backgroundTag":null,"analyzedSha":"951b0fc6838721f89d102c2bbe1b914e8d39d700","analyzedAt":"2026-08-13T19:01:32.939Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}