dotnet/orleans · error · ArgumentException
Journal metadata property names must not contain null charac
Error message
Journal metadata property names must not contain null characters.
What it means
A caller-supplied journal metadata property name contains a NUL (\0) character. ValidateCallerMetadataPropertyName (AzureTableJournalStorage.cs:1167) rejects embedded NULs because they break string handling in Azure Table property names and downstream serialization. The argument blamed is `key`.
Source
Thrown at src/Azure/Orleans.Journaling.AzureStorage/AzureTableJournalStorage.cs:1172
changed = true;
}
}
return changed;
}
private static void ValidateCallerMetadataProperty(string key, string value)
{
ValidateCallerMetadataPropertyName(key);
ArgumentNullException.ThrowIfNull(value);
}
private static void ValidateCallerMetadataPropertyName(string key)
{
ArgumentException.ThrowIfNullOrWhiteSpace(key);
if (key.IndexOf('\0') >= 0)
{
throw new ArgumentException("Journal metadata property names must not contain null characters.", nameof(key));
}
if (key.StartsWith("$", StringComparison.Ordinal))
{
throw new ArgumentException($"Journal metadata property '{key}' is provider-owned.", nameof(key));
}
}
private static ETag ToAzureETag(string eTag)
{
ArgumentException.ThrowIfNullOrWhiteSpace(eTag);
return new ETag(eTag);
}
private static bool IsEntityAlreadyExists(RequestFailedException exception)
=> exception.Status == 409
&& (string.Equals(exception.ErrorCode, "EntityAlreadyExists", StringComparison.Ordinal)
|| exception.Message.Contains("already exists", StringComparison.OrdinalIgnoreCase));View on GitHub (pinned to fca799fa70)
Solutions
- Sanitize keys before the call: strip or reject NUL characters.
- Validate keys come from a controlled vocabulary rather than raw external input.
- Add a unit test asserting metadata keys are printable.
Example fix
// before
storage.SetMetadata(new() { [badKey] = "v" }); // badKey contains '\0'
// after
var safeKey = badKey.Replace("\0", string.Empty);
if (string.IsNullOrWhiteSpace(safeKey)) throw new ArgumentException("Empty key");
storage.SetMetadata(new() { [safeKey] = "v" }); Defensive patterns
Strategy: validation
Validate before calling
foreach (var k in metadata.Keys)
if (k.IndexOf('\0') >= 0) throw new ArgumentException($"Key '{k}' contains a NUL character"); Type guard
static bool HasNoNul(string key) => key.IndexOf('\0') < 0; Prevention
- Sanitize keys derived from binary or external input.
- Reject non-printable key characters before the call.
- Keep metadata keys from a controlled vocabulary.
When it happens
Trigger: Calling a metadata set/update API with a dictionary key or remove-set entry containing '\0'; thrown at AzureTableJournalStorage.cs:1172.
Common situations: A key was read from a binary/encoded source without sanitizing; concatenated buffers introduced a NUL; user input was not validated before becoming a metadata key.
Related errors
- Journal metadata property '{propertyName}' cannot be both se
- Journal metadata property '{key}' is provider-owned.
- Journal metadata property names must not contain null charac
- Journal metadata property '{key}' is provider-owned.
- The journal id must not be the default value.
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/de8ddb4a87e5425f.
Report an issue: GitHub.