dotnet/orleans · error · ArgumentException
Table name "{tableName}" is invalid according to the followi
Error message
Table name "{tableName}" is invalid according to the following rules: 1. Table names may contain only alphanumeric characters. 2. Table names cannot begin with a numeric character. 3. Table names must be from 3 to 63 characters long. What it means
ArgumentException from AzureTableUtils.ValidateTableName when the table name does not match ^[A-Za-z][A-Za-z0-9]{2,62}$, the documented Azure Table Service naming rule. Names must be alphanumeric, start with a letter, and be 3-63 characters long. Validation runs at manager construction, so it surfaces before any storage I/O.
Source
Thrown at src/Azure/Shared/Storage/AzureTableUtils.cs:194
public static bool IsNotFoundError(HttpStatusCode httpStatusCode)
{
// Status and Error Codes
// http://msdn.microsoft.com/en-us/library/dd179382.aspx
if (httpStatusCode == HttpStatusCode.NotFound) return true;
if (httpStatusCode == HttpStatusCode.NotImplemented) return true; // New table: Azure table schema not yet initialized, so need to do first create
return false;
}
[GeneratedRegex("^[A-Za-z][A-Za-z0-9]{2,62}$")]
private static partial Regex TableNameRegex();
internal static void ValidateTableName(string tableName)
{
// Regular expression from documentation: https://learn.microsoft.com/rest/api/storageservices/understanding-the-table-service-data-model#table-names
if (!TableNameRegex().IsMatch(tableName))
{
throw new ArgumentException($"Table name \"{tableName}\" is invalid according to the following rules:"
+ " 1. Table names may contain only alphanumeric characters."
+ " 2. Table names cannot begin with a numeric character."
+ " 3. Table names must be from 3 to 63 characters long.");
}
}
/// <summary>
/// Remove any characters that can't be used in Azure PartitionKey or RowKey values.
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string SanitizeTableProperty(string key)
{
// Remove any characters that can't be used in Azure PartitionKey or RowKey values
// http://www.jamestharpe.com/web-development/azure-table-service-character-combinations-disallowed-in-partitionkey-rowkey/
key = key
.Replace('/', '_') // Forward slash
.Replace('\\', '_') // BackslashView on GitHub (pinned to fca799fa70)
Solutions
- Sanitize your ServiceId/ClusterId so the resulting table name is alphanumeric and 3-63 chars, starting with a letter.
- Provide a custom table-name policy or configure the relevant UseXxxAzureStorage().TableName to a valid literal.
- Validate candidate names at startup with the same regex: Regex.IsMatch(name, @"^[A-Za-z][A-Za-z0-9]{2,62}$").
Example fix
// before
var tableName = $"{serviceId}-{clusterId}"; // '-' is illegal
// after
var tableName = Utils.SanitizeTableProperty($"{serviceId}{clusterId}");
// ensure length 3..63 and first char a letter; consider prefix 'o' if needed Defensive patterns
Strategy: validation
Validate before calling
if (!Regex.IsMatch(tableName, @"^[A-Za-z][A-Za-z0-9]{2,62}$"))
throw new ArgumentException($"Invalid table name: {tableName}");
new AzureTableDataManager<T>(tableName, ...); Type guard
static bool IsValidTableName(string name) => Regex.IsMatch(name, @"^[A-Za-z][A-Za-z0-9]{2,62}$"); Prevention
- Sanitize ClusterId/ServiceId into alphanumeric only
- Keep table names 3-63 chars starting with a letter
- Validate names at startup, not at first storage call
When it happens
Trigger: Constructing any AzureTableDataManager-derived manager (membership, reminders, grain directory, streaming, persistence) with a TableName containing illegal characters, starting with a digit, or being too short/long. The regex is source-generated.
Common situations: Deriving the table name from a ClusterId/ServiceId that contains hyphens, dots, or underscores; a ServiceId that is empty or 1-2 chars; using a lowercased/upper-cased variant that starts with a number; or a custom ITableNameProvider returning an invalid value.
Related errors
- Too many rows for bulk update - max {this.StoragePolicyOptio
- Key length {0} is too long to be an Azure table key. Key={1}
- Unknown Playground:Storage:Provider value '{storageProvider}
- The table version entry must have a membership version.
- Value cannot be null. (Parameter 'clusterId')
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/eb6bb25a86e18222.
Report an issue: GitHub.