clockworklabs/SpacetimeDB · error · ArgumentNullException
Cannot serialize a null string as BSATN String. To serialize
Error message
Cannot serialize a null string as BSATN String. To serialize a null string you must use a nullable string (string?) so it is encoded as a BSATN option.
What it means
Error "Cannot serialize a null string as BSATN String. To serialize a null string you must use a nullable string (string?) so it is encoded as a BSATN option." thrown in clockworklabs/SpacetimeDB.
Source
Thrown at crates/bindings-csharp/BSATN.Runtime/BSATN/Runtime.cs:560
writer.Write(value.Length);
writer.Write(value);
}
public AlgebraicType GetAlgebraicType(ITypeRegistrar registrar) =>
new AlgebraicType.Array(new AlgebraicType.U8(default));
}
// String is a special case of byte array with extra checks.
public readonly struct String : IReadWrite<string>
{
public string Read(BinaryReader reader) =>
Encoding.UTF8.GetString(ByteArray.Instance.Read(reader));
public void Write(BinaryWriter writer, string value)
{
if (value is null)
{
throw new ArgumentNullException(
nameof(value),
"Cannot serialize a null string as BSATN String. To serialize a null string you must use a nullable string (string?) so it is encoded as a BSATN option."
);
}
ByteArray.Instance.Write(writer, Encoding.UTF8.GetBytes(value));
}
public AlgebraicType GetAlgebraicType(ITypeRegistrar registrar) =>
new AlgebraicType.String(default);
}
public readonly struct List<Element, ElementRW> : IReadWrite<List<Element>>
where ElementRW : IReadWrite<Element>, new()
{
private static readonly Enumerable<Element, ElementRW> enumerable = new();
private static readonly ElementRW elementRW = new();
View on GitHub (pinned to 524b4487d9)
When it happens
Trigger: Thrown at crates/bindings-csharp/BSATN.Runtime/BSATN/Runtime.cs:560 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/d1162b08a32c5bed.
Report an issue: GitHub.