clockworklabs/SpacetimeDB · error · ArgumentException

Byte array must be exactly {Size} bytes long.

Error message

Byte array must be exactly {Size} bytes long.

What it means

Error "Byte array must be exactly {Size} bytes long." thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/bindings-csharp/BSATN.Runtime/BSATN/U128.cs:42

    /// <summary>Initializes a new instance of the <see cref="U128" /> struct.</summary>
    /// <param name="upper">The upper 64-bits of the 128-bit value.</param>
    /// <param name="lower">The lower 64-bits of the 128-bit value.</param>
    public U128(ulong upper, ulong lower)
    {
        _upper = upper;
        _lower = lower;
    }

    internal ulong Lower => _lower;

    internal ulong Upper => _upper;

    /// Returns a <see cref="U128" /> from a big-endian byte array.
    public static U128 FromBytesBigEndian(ReadOnlySpan<byte> bytes)
    {
        if (bytes.Length != Size)
        {
            throw new ArgumentException(
                $"Byte array must be exactly {Size} bytes long.",
                nameof(bytes)
            );
        }

        var upper = BinaryPrimitives.ReadUInt64BigEndian(bytes[..8]);
        var lower = BinaryPrimitives.ReadUInt64BigEndian(bytes[8..16]);

        return new U128(upper, lower);
    }

    public byte[] ToBytesBigEndian()
    {
        var bytes = new byte[Size];

        BinaryPrimitives.WriteUInt64BigEndian(bytes.AsSpan(0, 8), _upper);
        BinaryPrimitives.WriteUInt64BigEndian(bytes.AsSpan(8, 8), _lower);

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/bindings-csharp/BSATN.Runtime/BSATN/U128.cs:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/ffcbb70eb3824a3e. Report an issue: GitHub.