OrchardCMS/OrchardCore · error · InvalidOperationException

The configured identity column size

Error message

The configured identity column size '{identityColumnSize}' is invalid.

What it means

GetIdentityColumnSize reads 'IdentityColumnSize' from shell settings and accepts only the strings "Int64" or "Int32" (defaulting to Int64 for uninitialized default shells, Int32 otherwise). Any other value throws InvalidOperationException because the identity column SQL type cannot be derived from it.

Solutions

  1. Set the value to exactly "Int64" or "Int32".
  2. Remove the setting entirely to use the default (Int64 pre-setup, Int32 after).
  3. Fix typos/casing in appsettings.json or the tenant settings file, then restart the tenant.

Example fix

// before (appsettings.json)
"OrchardCore_Data_TableOptions": { "DefaultIdentityColumnSize": "BigInt" }
// after
"OrchardCore_Data_TableOptions": { "DefaultIdentityColumnSize": "Int64" }
Defensive patterns

Strategy: validation

Validate before calling

var size = config["OrchardCore_Data_TableOptions:DefaultIdentityColumnSize"]?.Trim();
if (!string.IsNullOrEmpty(size) && size is not ("Int64" or "Int32"))
    throw new InvalidOperationException($"IdentityColumnSize '{size}' invalid; use 'Int64' or 'Int32'.");

Type guard

bool IsValidIdentityColumnSize(string s) { s = s?.Trim(); return string.IsNullOrEmpty(s) || s is "Int64" or "Int32"; }

Try / catch

try { var opts = shellSettings.GetDatabaseTableOptions(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("identity column size")) { _logger.LogCritical(ex, "Fix IdentityColumnSize in tenant settings"); throw; }

Prevention

When it happens

Trigger: Configuring OrchardCore_Data_TableOptions:DefaultIdentityColumnSize (or per-tenant IdentityColumnSize) with a value outside {"Int64","Int32"} — e.g. "64", "BigInt", "long" — then initializing a tenant or calling GetDatabaseTableOptions().

Common situations: Assuming the setting takes a numeric size or a SQL type name like BIGINT; case-sensitive mismatch expectations (compare uses exact strings 'Int64'/'Int32'); copy-paste from older docs using different naming.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13). Data as JSON: /api/errors/697f3b418ffd2659. Report an issue: GitHub.

Appendix: source

Thrown at src/OrchardCore/OrchardCore.Data.Abstractions/ShellSettingsExtensions.cs:85

        }

        return tableNameSeparator;
    }

    public static string GetIdentityColumnSize(this ShellSettings shellSettings)
    {
        var identityColumnSize = (!shellSettings.IsInitialized()
            ? shellSettings[DefaultIdentityColumnSize]
            : shellSettings["IdentityColumnSize"])
            ?.Trim();

        if (string.IsNullOrEmpty(identityColumnSize))
        {
            identityColumnSize = !shellSettings.IsInitialized() ? nameof(Int64) : nameof(Int32);
        }
        else if (!s_identityColumnSizes.Contains(identityColumnSize))
        {
            throw new InvalidOperationException($"The configured identity column size '{identityColumnSize}' is invalid.");
        }

        return identityColumnSize;
    }
}

View on GitHub (pinned to 4306c0717f)