elsa-workflows/elsa-core · error · InvalidOperationException
The console log provider registration is invalid.
Error message
The console log provider registration is invalid.
What it means
CreateProvider materializes an IConsoleLogProvider from an already-resolved ServiceDescriptor (the decoration helper found a registration but it carries no implementation instance, factory, or type). A descriptor with none of Instance/ImplementationFactory/ImplementationType is malformed, so this InvalidOperationException is thrown.
Solutions
- Register the provider with an explicit implementation: AddSingleton<IConsoleLogProvider, MyProvider>() or AddSingleton<IConsoleLogProvider>(sp => new MyProvider(...))
- Inspect the DI registrations (DebugView of IServiceCollection) to find the empty descriptor and remove/fix it
- Ensure the module that registers a concrete provider is actually configured/installed
Example fix
// before services.AddSingleton<IConsoleLogProvider>(); // no implementation // after services.AddSingleton<IConsoleLogProvider, InMemoryConsoleLogProvider>();
Defensive patterns
Strategy: validation
Validate before calling
var sp = services.BuildServiceProvider();
if (sp.GetService<IConsoleLogProvider>() is null)
throw new InvalidOperationException("IConsoleLogProvider has no valid registration."); Try / catch
try { provider = CreateOrResolveProvider(serviceProvider); }
catch (InvalidOperationException ex) when (ex.Message == "The console log provider registration is invalid.")
{ logger.LogError(ex, "Fix the IConsoleLogProvider DI registration"); } Prevention
- Always register IConsoleLogProvider with a concrete type or factory
- Never call AddSingleton<T>() without an implementation
- Verify registrations at startup with a self-check
When it happens
Trigger: Registering IConsoleLogProvider in a way that leaves the descriptor without an implementation — e.g. calling AddSingleton<IConsoleLogProvider>() with no implementation argument, or relying on a constructor-only open generic registration the resolver cannot materialize.
Common situations: Misconfigured DI like services.AddSingleton(typeof(IConsoleLogProvider)) with no type; registration made conditional and never populated; a descriptor added by third-party setup code that omitted the implementation.
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
- Register with configured before calling , or call with a…
- The secret binding resolver is unavailable.
- External Authentication handle-hashing settings are…
- Output converter IDs cannot be empty.
- There is no handler to handle the
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/e36a5a6652d6bb44.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Diagnostics.ConsoleLogs/Extensions/ConsoleLogProviderServiceCollectionExtensions.cs:38
sp => new ElsaConsoleLogProvider(
CreateProvider(sp, descriptor),
sp.GetRequiredService<IConsoleLogContextAccessor>(),
sp.GetRequiredService<ElsaConsoleLogRecentBuffer>()),
descriptor.Lifetime));
}
private static IConsoleLogProvider CreateProvider(IServiceProvider serviceProvider, ServiceDescriptor descriptor)
{
if (descriptor.ImplementationInstance is IConsoleLogProvider instance)
return instance;
if (descriptor.ImplementationFactory != null)
return (IConsoleLogProvider)descriptor.ImplementationFactory(serviceProvider)!;
if (descriptor.ImplementationType != null)
return (IConsoleLogProvider)ActivatorUtilities.CreateInstance(serviceProvider, descriptor.ImplementationType);
throw new InvalidOperationException("The console log provider registration is invalid.");
}
}
View on GitHub (pinned to fe9217bdfa)