elsa-workflows/elsa-core · error · ArgumentException
Output converter IDs cannot be empty.
Error message
Output converter IDs cannot be empty.
What it means
AddOutputConverter registers an output converter with an ID; ValidateUniqueId rejects empty/whitespace IDs with ArgumentException before any duplicate check. This keeps converter IDs stable and valid for lookup. It is a guard against misconfigured registrations.
Solutions
- Pass a non-empty, meaningful converter ID string
- If the ID comes from configuration, fail fast with a clear config error instead of registering
- Guard with string.IsNullOrWhiteSpace before calling AddOutputConverter
Example fix
// before
services.AddOutputConverter(new OutputConverterDescriptor { Id = config["Converter:Id"]! });
// after
var id = config["Converter:Id"];
if (string.IsNullOrWhiteSpace(id)) throw new InvalidOperationException("Output converter id must be configured.");
services.AddOutputConverter(new OutputConverterDescriptor { Id = id }); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(id)) throw new ArgumentException("Converter id must be non-empty.", nameof(id)); Try / catch
try { services.AddOutputConverter(descriptor); } catch (ArgumentException ex) when (ex.ParamName == "id") { logger.LogError(ex, "Invalid output converter id"); } Prevention
- Never build IDs from possibly-empty config values without checking
- Centralize converter registration so IDs are reviewed in one place
When it happens
Trigger: Calling services.AddOutputConverter(new OutputConverterDescriptor { Id = "" }) or AddOutputConverter(id: " ", ...) with a null, empty, or whitespace-only ID string.
Common situations: Building the descriptor from config where the ID key is missing; string interpolation producing an empty value; copy-pasting a registration template without filling in the ID.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Register with configured before calling , or call with a…
- The console log provider registration is invalid.
- The secret binding resolver is unavailable.
- External Authentication handle-hashing settings are…
- Invalid value type.
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/2b2021f69bf22fcb.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Workflows.Core/Extensions/OutputConverterServiceCollectionExtensions.cs:42
OutputConverterRegistry.ValidateDescriptor(descriptor);
ValidateUniqueId(services, descriptor.Id);
var registration = new OutputConverterRegistration(descriptor, descriptor.Id, serviceLifetime);
services.AddSingleton(registration);
services.Add(ServiceDescriptor.DescribeKeyed(
typeof(IOutputConverter),
descriptor.Id,
typeof(TConverter),
serviceLifetime));
services.TryAddSingleton<IOutputConverterRegistry, OutputConverterRegistry>();
return services;
}
private static void ValidateUniqueId(IServiceCollection services, string id)
{
if (string.IsNullOrWhiteSpace(id))
throw new ArgumentException("Output converter IDs cannot be empty.", nameof(id));
var existingRegistration = services
.Where(x => x.ServiceType == typeof(OutputConverterRegistration))
.Select(x => x.ImplementationInstance)
.OfType<OutputConverterRegistration>()
.FirstOrDefault(x => string.Equals(x.Descriptor.Id, id, StringComparison.OrdinalIgnoreCase));
if (existingRegistration != null)
throw new InvalidOperationException($"Output converter ID '{id}' is already registered or differs from '{existingRegistration.Descriptor.Id}' only by case.");
}
}
View on GitHub (pinned to fe9217bdfa)