mgth/LittleBigMouse · error · FormatException
Macro delays must be between 0 and 10000 ms.
Error message
Macro delays must be between 0 and 10000 ms.
What it means
Thrown by RemoteMacro.Parse when a token parsed as an integer is treated as a delay following the previous KEY_ command but falls outside the allowed 0-10000 ms range. It fires whenever a user-supplied macro sequence contains a numeric token like '-5' or '20000', enforcing an upper bound so a macro cannot stall the remote-control session indefinitely.
Solutions
- Edit the macro sequence so every numeric delay token is between 0 and 10000 milliseconds.
- Split longer pauses into multiple consecutive delay tokens, e.g. 'KEY_POWER,10000,10000' instead of 'KEY_POWER,20000'.
- Remove or correct malformed delay tokens such as negative or transposed numbers before saving the macro.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs:21 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mgth/LittleBigMouse@7a42f01d47 (2026-09-16).
Data as JSON: /api/errors/4eb6fe2d4e273101.
Report an issue: GitHub.
Appendix: source
Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs:21
namespace LittleBigMouse.Plugin.Vcp.Avalonia;
/// <summary>Shared parser for Samsung and VIDAA remote-key macros.</summary>
public static class RemoteMacro
{
public static IReadOnlyList<(string Key, TimeSpan DelayAfter)> Parse(string sequence)
{
var result = new List<(string Key, TimeSpan DelayAfter)>();
var tokens = sequence.Split(
[',', ';', '+', '\n', '\r'],
StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
foreach (var token in tokens)
{
if (int.TryParse(token, out var milliseconds))
{
if (result.Count == 0) throw new FormatException("A delay must follow a KEY_ command.");
if (milliseconds is < 0 or > 10000)
throw new FormatException("Macro delays must be between 0 and 10000 ms.");
result[^1] = (result[^1].Key, TimeSpan.FromMilliseconds(milliseconds));
continue;
}
var key = token.ToUpperInvariant();
if (!key.StartsWith("KEY_", StringComparison.Ordinal) || key.Any(char.IsWhiteSpace))
throw new FormatException($"Invalid remote key: {token}");
result.Add((key, TimeSpan.FromMilliseconds(150)));
}
if (result.Count == 0) throw new FormatException("Enter at least one KEY_ command.");
return result;
}
}
View on GitHub (pinned to 7a42f01d47)