{"record":{"id":"951984d716b5401d","repo":"OrchardCMS/OrchardCore","slug":"the-configured-table-name-separator-tablenameseparator-is","errorCode":null,"errorMessage":"The configured table name separator '{tableNameSeparator}' is invalid.","messagePattern":"The configured table name separator '(.+?)' is invalid\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.Data.Abstractions/ShellSettingsExtensions.cs","lineNumber":66,"sourceCode":"\n    public static string GetTableNameSeparator(this ShellSettings shellSettings)\n    {\n        var tableNameSeparator = (!shellSettings.IsInitialized()\n            ? shellSettings[DefaultTableNameSeparator]\n            : shellSettings[\"TableNameSeparator\"])\n            ?.Trim();\n\n        if (string.IsNullOrEmpty(tableNameSeparator))\n        {\n            tableNameSeparator = \"_\";\n        }\n        else if (tableNameSeparator == \"NULL\")\n        {\n            tableNameSeparator = string.Empty;\n        }\n        else if (tableNameSeparator.Any(c => c != '_'))\n        {\n            throw new InvalidOperationException($\"The configured table name separator '{tableNameSeparator}' is invalid.\");\n        }\n\n        return tableNameSeparator;\n    }\n\n    public static string GetIdentityColumnSize(this ShellSettings shellSettings)\n    {\n        var identityColumnSize = (!shellSettings.IsInitialized()\n            ? shellSettings[DefaultIdentityColumnSize]\n            : shellSettings[\"IdentityColumnSize\"])\n            ?.Trim();\n\n        if (string.IsNullOrEmpty(identityColumnSize))\n        {\n            identityColumnSize = !shellSettings.IsInitialized() ? nameof(Int64) : nameof(Int32);\n        }\n        else if (!s_identityColumnSizes.Contains(identityColumnSize))\n        {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.Data.Abstractions/ShellSettingsExtensions.cs#L48-L84","documentation":"GetTableNameSeparator reads the shell setting 'TableNameSeparator' (or its default) and only accepts empty ('NULL' literal or empty => no separator) or strings composed solely of underscores. Any other character in the configured separator is rejected with InvalidOperationException, because table names are built by concatenating prefixes with this separator and invalid characters would corrupt SQL table names.","triggerScenarios":"Configuring OrchardCore_Data_TableOptions:DefaultTableNameSeparator (appsettings.json or ShellSettings) with characters other than '_' or the literal 'NULL' — e.g. '-', '.', or a multi-character value like '__x' — then booting a tenant or calling GetDatabaseTableOptions().","commonSituations":"Copy-pasted config from another CMS using '-' separators; misunderstanding that only '_' or NULL are allowed; typos like '\"__ \"' with spaces (note settings are trimmed first).","solutions":["Set the separator to '_' (default), '__', or the literal string \"NULL\" for no separator.","Remove invalid characters from TableNameSeparator in appsettings.json / tenant App_Data settings.","Fix the DefaultTableNameSeparator in the shell configuration before tenant initialization."],"exampleFix":"// before (appsettings.json)\n\"OrchardCore_Data_TableOptions\": { \"DefaultTableNameSeparator\": \"-\" }\n// after\n\"OrchardCore_Data_TableOptions\": { \"DefaultTableNameSeparator\": \"_\" }  // or \"NULL\" for none","handlingStrategy":"validation","validationCode":"var sep = config[\"OrchardCore_Data_TableOptions:DefaultTableNameSeparator\"]?.Trim();\nif (!string.IsNullOrEmpty(sep) && sep != \"NULL\" && sep.Any(c => c != '_'))\n    throw new InvalidOperationException($\"TableNameSeparator '{sep}' invalid; use '_' characters or 'NULL'.\");","typeGuard":"bool IsValidSeparator(string s) { s = s?.Trim(); return string.IsNullOrEmpty(s) || s == \"NULL\" || s.All(c => c == '_'); }","tryCatchPattern":"try { var opts = shellSettings.GetDatabaseTableOptions(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"table name separator\")) { _logger.LogCritical(ex, \"Fix TableNameSeparator in tenant settings\"); throw; }","preventionTips":["Validate table options in your deployment config pipeline before rollout.","Only use '_' or the literal 'NULL' for the separator.","Keep a shared appsettings template with known-good table options.","Test tenant startup against staging config before production."],"tags":["configuration","database","table-names","startup"],"backgroundTag":"invalid-config-value","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}