elsa-workflows/elsa-core · error · NotSupportedException
Provider ' ' is not supported.
Error message
Provider '{providerName}' is not supported. What it means
Elsa's EF Core bulk upsert helper builds provider-specific raw SQL for batched upserts. It only has generators for SQL Server, SQLite, PostgreSQL, MySQL/MariaDB, and Oracle; any other or unrecognized provider name hits the fallback arm of the switch expression and throws NotSupportedException. The error means you configured a DbContext provider (e.g. InMemory, Sqlite with a different connection string casing, or a custom provider) that bulk-upsert does not implement.
Solutions
- Switch the persistence feature to a supported relational provider: SqlServer, Sqlite, PostgreSql, MySql, or Oracle EF Core packages.
- If you're using the InMemory provider for testing, disable bulk upsert paths or use the standard SaveChanges-based persistence instead of BulkUpsertAsync.
- Add a custom generator to the switch for your provider (fork or PR upstream) if you must keep that provider.
- Verify the provider name by checking the configured UseXxx call on the DbContext; substring matching is case-sensitive on the lowercase provider names listed.
Example fix
// before (InMemory in tests)
options.UseInMemoryDatabase("elsa");
// after
options.UseSqlite(connectionString); Defensive patterns
Strategy: try-catch
Validate before calling
var providerName = dbContext.Database.ProviderName ?? "";
string[] supported = { "sqlserver", "sqlite", "postgres", "mysql", "oracle" };
bool bulkUpsertSupported = supported.Any(p => providerName.Contains(p));
if (!bulkUpsertSupported) throw new InvalidOperationException($"{providerName} does not support bulk upsert"); Type guard
bool SupportsBulkUpsert(string? providerName) =>
providerName is not null &&
(providerName.Contains("sqlserver") || providerName.Contains("sqlite") ||
providerName.Contains("postgres") || providerName.Contains("mysql") ||
providerName.Contains("oracle")); Try / catch
try
{
await store.BulkUpsertAsync(entities);
}
catch (NotSupportedException ex)
{
// fall back to per-entity SaveChanges persistence
logger.LogWarning(ex, "Bulk upsert unsupported for this provider; using fallback");
await SaveIndividuallyAsync(entities);
} Prevention
- Pin test/prod environments to the same supported relational provider.
- Assert Database.ProviderName in a startup health check before enabling bulk-upsert code paths.
- Keep an InMemory-safe fallback persistence path for unit tests.
When it happens
Trigger: Calling BulkUpsertAsync on a store whose providerName (derived from the EF Core relational provider) does not contain any of the substrings 'sqlserver', 'sqlite', 'postgres', 'mysql', or 'oracle' — e.g. using the EF Core InMemory provider or an unsupported third-party provider.
Common situations: Running workflows/tests against the EFCore InMemory database provider; using a forked or renamed provider assembly whose name doesn't match; a typo in a custom provider name; upgrading Elsa and switching persistence providers to one not yet supported by bulk upsert.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Connection string not configured for
- 23505
- Unable to save data
- The persisted external authentication value could not be…
- Storage unit ' ' is not declared in the persistence schema.
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/d98f0c3e9e27954d.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Persistence.EFCore.Common/Extensions/BulkUpsertExtensions.cs:71
CancellationToken cancellationToken = default)
where TDbContext : DbContext
where TEntity : class, new()
{
if (entities.Count == 0)
return;
// Identify the current provider (e.g., "Microsoft.EntityFrameworkCore.SqlServer")
var providerName = dbContext.Database.ProviderName?.ToLowerInvariant() ?? string.Empty;
// Determine the method for generating SQL based on the provider
Func<DbContext, IList<TEntity>, Expression<Func<TEntity, string>>, (string, object[])> generateSql = providerName switch
{
var pn when pn.Contains("sqlserver") => GenerateSqlServerUpsert,
var pn when pn.Contains("sqlite") => GenerateSqliteUpsert,
var pn when pn.Contains("postgres") => GeneratePostgresUpsert,
var pn when pn.Contains("mysql") => GenerateMySqlUpsert,
var pn when pn.Contains("oracle") => GenerateOracleUpsert,
_ => throw new NotSupportedException($"Provider '{providerName}' is not supported.")
};
// Loop through batched entities
foreach (var batch in entities.Chunk(batchSize))
{
// Generate SQL and parameters
var (sql, parameters) = generateSql(dbContext, batch, keySelector);
await dbContext.Database.ExecuteSqlRawAsync(sql, parameters, cancellationToken);
}
}
private static (string, object[]) GenerateSqlServerUpsert<TEntity>(
DbContext dbContext,
IList<TEntity> entities,
Expression<Func<TEntity, string>> keySelector)
where TEntity : class
{View on GitHub (pinned to fe9217bdfa)