{"record":{"id":"b965297858c00b7c","repo":"babalae/better-genshin-impact","slug":"error-b96529","errorCode":null,"errorMessage":"相对鼠标样本时间戳超出有效范围。","messagePattern":"相对鼠标样本时间戳超出有效范围。","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/Service/Instance/InstanceIpcProtocol.cs","lineNumber":230,"sourceCode":"\n        var firstSequence = BinaryPrimitives.ReadUInt64LittleEndian(span[sizeof(ushort)..]);\n        var baseTicks = BinaryPrimitives.ReadInt64LittleEndian(span[(sizeof(ushort) + sizeof(ulong))..]);\n        var samples = new RelativeMouseSample[count];\n        var offset = RelativeMouseBatchHeaderLength;\n        for (var index = 0; index < count; index++)\n        {\n            var deltaX = BinaryPrimitives.ReadInt32LittleEndian(span[offset..]);\n            var deltaY = BinaryPrimitives.ReadInt32LittleEndian(span[(offset + sizeof(int))..]);\n            var offsetMicroseconds =\n                BinaryPrimitives.ReadInt32LittleEndian(span[(offset + sizeof(int) * 2)..]);\n            long timestampTicks;\n            try\n            {\n                timestampTicks = checked(baseTicks + offsetMicroseconds * 10L);\n            }\n            catch (OverflowException exception)\n            {\n                throw new InvalidDataException(\"相对鼠标样本时间戳超出有效范围。\", exception);\n            }\n\n            if (timestampTicks < DateTime.MinValue.Ticks\n                || timestampTicks > DateTime.MaxValue.Ticks)\n            {\n                throw new InvalidDataException(\"相对鼠标样本时间戳超出有效范围。\");\n            }\n\n            samples[index] = new RelativeMouseSample(\n                deltaX,\n                deltaY,\n                new DateTime(timestampTicks, DateTimeKind.Utc));\n            offset += RelativeMouseSampleLength;\n        }\n\n        return (firstSequence, samples);\n    }\n","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/Service/Instance/InstanceIpcProtocol.cs#L212-L248","documentation":"Thrown by ReadRelativeMouseBatch when the reconstructed timestamp (baseTicks + offsetMicroseconds * 10) overflows int64 (caught as OverflowException and re-wrapped), or when the result falls outside DateTime.MinValue.Ticks..DateTime.MaxValue.Ticks. Each sample stores a microsecond offset relative to the batch baseTicks; an absurd offset or corrupted baseTicks pushes the timestamp out of range.","triggerScenarios":"Corrupt offsetMicroseconds (e.g. near int.MaxValue causing overflow when multiplied by 10), a corrupt baseTicks value, or a peer clock that produced timestamps outside the DateTime representable range.","commonSituations":"Stream/memory corruption flipping timestamp bytes; a peer bug writing offsets without the checked arithmetic the writer uses; version skew in the timestamp encoding.","solutions":["Restart both instances.","Ensure both instances run the same build (timestamp encoding must match).","If reproducing, log baseTicks and the offending offsetMicroseconds to identify whether it is corruption or an encoding mismatch."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    var (firstSeq, samples) = InstanceIpcProtocol.ReadRelativeMouseBatch(frame.Value);\n}\ncatch (InvalidDataException ex) when (ex.Message.Contains(\"时间戳超出有效范围\"))\n{\n    logger.LogError(ex, \"Mouse-sample timestamp out of range; corruption or encoding mismatch\");\n}","preventionTips":["Run matching builds so the timestamp offset encoding is consistent.","Restart instances to recover from transient corruption.","If reproducing, log baseTicks and the offending offsetMicroseconds to trace the writer-side arithmetic."],"tags":["ipc","protocol","mouse","data-corruption","named-pipe"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}