elsa-workflows/elsa-core · error · JsonException
The console log stream filter has an unsupported numeric…
Error message
The console log stream filter has an unsupported numeric value.
What it means
ReadNumber converts a JSON integer token to a ConsoleStream, but only if the integer corresponds to a defined ConsoleStream enum member. Integers that are not parseable or not defined throw this JsonException.
Solutions
- Send numeric value 1 (stdout) or 2 (stderr), or use the string form "stdout"/"stderr"
- Prefer the string representation in API payloads to avoid enum-numbering skew
- Validate client-side with Enum.IsDefined equivalent before sending
Example fix
// before
{ "stream": 0 }
// after
{ "stream": 1 } Defensive patterns
Strategy: validation
Validate before calling
if (raw is < 1 or > 2 || !Enum.IsDefined(typeof(ConsoleStream), (int)raw)) throw new ArgumentException($"{raw} is not a defined ConsoleStream value."); Type guard
bool IsDefinedStreamNumber(int n) => Enum.IsDefined(typeof(ConsoleStream), n);
Try / catch
try { filter = JsonSerializer.Deserialize<ElsaConsoleLogFilter>(payload); }
catch (JsonException ex) when (ex.Message.Contains("unsupported numeric value"))
{ logger.LogWarning("Bad numeric stream filter"); } Prevention
- Prefer string stream values over raw integers in payloads
- Validate numeric enums with Enum.IsDefined before sending
- Synchronize enum definitions across client/server versions
When it happens
Trigger: Sending a numeric stream filter such as 3, -1, or a non-integer number that does not map to a defined ConsoleStream member (only 1=Stdout, 2=Stderr are defined).
Common situations: Clients serializing the enum of a different/newer version with extra members; sending 0 (default, undefined); sending arbitrary ids from a client-side enum.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Cannot deserialize to .
- Failed to deserialize
- The binding to activity type
- Expected number or string.
- Cannot convert to bool
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/8c7b0ad67e55dc17.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Diagnostics.ConsoleLogs/Contracts/ConsoleStreamJsonConverter.cs:52
_ => throw new JsonException($"Unsupported console stream value '{value}'.")
});
}
private static ConsoleStream? ReadString(string? value)
{
return value?.Trim().ToLowerInvariant() switch
{
null or "" or "all" => null,
"stdout" => ConsoleStream.Stdout,
"stderr" => ConsoleStream.Stderr,
_ => throw new JsonException("The console log stream filter must be 'stdout', 'stderr', or null.")
};
}
private static ConsoleStream ReadNumber(ref Utf8JsonReader reader)
{
if (!reader.TryGetInt32(out var value) || !Enum.IsDefined(typeof(ConsoleStream), value))
throw new JsonException("The console log stream filter has an unsupported numeric value.");
return (ConsoleStream)value;
}
}
View on GitHub (pinned to fe9217bdfa)