clockworklabs/SpacetimeDB · error · ArgumentException
Must be 16 bytes
Error message
Must be 16 bytes
What it means
Error "Must be 16 bytes" thrown in clockworklabs/SpacetimeDB.
Source
Thrown at crates/bindings-csharp/BSATN.Runtime/BSATN/Uuid.cs:55
/// 16 random bytes used for entropy.
/// </param>
/// <example>
/// <code>
/// var randomBytes = new byte[16];
/// RandomNumberGenerator.Fill(randomBytes);
/// var uuid = Uuid.FromRandomBytesV4(randomBytes);
/// Console.WriteLine(uuid);
/// // Output: 166a036f-90f3-714a-9731-c8814b70e326
/// </code>
/// </example>
/// <exception cref="ArgumentException">
/// Thrown if <paramref name="randomBytes"/> is not exactly 16 bytes long.
/// </exception>
public static Uuid FromRandomBytesV4(ReadOnlySpan<byte> randomBytes)
{
if (randomBytes.Length != 16)
{
throw new ArgumentException("Must be 16 bytes", nameof(randomBytes));
}
Span<byte> bytes = stackalloc byte[16];
randomBytes.CopyTo(bytes);
bytes[6] = (byte)((bytes[6] & 0x0F) | 0x40); // version 4
bytes[8] = (byte)((bytes[8] & 0x3F) | 0x80); // variant RFC 4122
return new(U128.FromBytesBigEndian(bytes));
}
/// <summary>
/// Generate a <see cref="Uuid"/> `v7` using a monotonic counter from 0 to 2^31-1,
/// a Unix timestamp in milliseconds, and 4 random bytes.
///
/// <example>
/// <code>
/// int counter = 1;
/// var now = new Timestamp(1_686_000_000_000);View on GitHub (pinned to 524b4487d9)
When it happens
Trigger: Thrown at crates/bindings-csharp/BSATN.Runtime/BSATN/Uuid.cs:55 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/9921d14caa50cab3.
Report an issue: GitHub.