{"record":{"id":"eb6bb25a86e18222","repo":"dotnet/orleans","slug":"table-name-tablename-is-invalid-according-to-t","errorCode":null,"errorMessage":"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.","messagePattern":"Table name \"(.+?)\" 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\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Azure/Shared/Storage/AzureTableUtils.cs","lineNumber":194,"sourceCode":"        public static bool IsNotFoundError(HttpStatusCode httpStatusCode)\n        {\n            // Status and Error Codes\n            // http://msdn.microsoft.com/en-us/library/dd179382.aspx\n\n            if (httpStatusCode == HttpStatusCode.NotFound) return true;\n            if (httpStatusCode == HttpStatusCode.NotImplemented) return true; // New table: Azure table schema not yet initialized, so need to do first create\n            return false;\n        }\n\n        [GeneratedRegex(\"^[A-Za-z][A-Za-z0-9]{2,62}$\")]\n        private static partial Regex TableNameRegex();\n\n        internal static void ValidateTableName(string tableName)\n        {\n            // Regular expression from documentation: https://learn.microsoft.com/rest/api/storageservices/understanding-the-table-service-data-model#table-names\n            if (!TableNameRegex().IsMatch(tableName))\n            {\n                throw new ArgumentException($\"Table name \\\"{tableName}\\\" is invalid according to the following rules:\"\n                    + \" 1. Table names may contain only alphanumeric characters.\"\n                    + \" 2. Table names cannot begin with a numeric character.\"\n                    + \" 3. Table names must be from 3 to 63 characters long.\");\n            }\n        }\n\n        /// <summary>\n        /// Remove any characters that can't be used in Azure PartitionKey or RowKey values.\n        /// </summary>\n        /// <param name=\"key\"></param>\n        /// <returns></returns>\n        public static string SanitizeTableProperty(string key)\n        {\n            // Remove any characters that can't be used in Azure PartitionKey or RowKey values\n            // http://www.jamestharpe.com/web-development/azure-table-service-character-combinations-disallowed-in-partitionkey-rowkey/\n            key = key\n                .Replace('/', '_')        // Forward slash\n                .Replace('\\\\', '_')       // Backslash","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Shared/Storage/AzureTableUtils.cs#L176-L212","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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}$\")."],"exampleFix":"// before\nvar tableName = $\"{serviceId}-{clusterId}\"; // '-' is illegal\n\n// after\nvar tableName = Utils.SanitizeTableProperty($\"{serviceId}{clusterId}\");\n// ensure length 3..63 and first char a letter; consider prefix 'o' if needed","handlingStrategy":"validation","validationCode":"if (!Regex.IsMatch(tableName, @\"^[A-Za-z][A-Za-z0-9]{2,62}$\"))\n    throw new ArgumentException($\"Invalid table name: {tableName}\");\nnew AzureTableDataManager<T>(tableName, ...);","typeGuard":"static bool IsValidTableName(string name) => Regex.IsMatch(name, @\"^[A-Za-z][A-Za-z0-9]{2,62}$\");","tryCatchPattern":null,"preventionTips":["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"],"tags":["argument-validation","azure-storage","config","naming"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}