mgth/LittleBigMouse · error · FormatException

Invalid remote key

Error message

Invalid remote key: {token}

What it means

Thrown by RemoteMacro.Parse when a token is neither a numeric delay nor a recognized remote-key name: the uppercase token does not start with 'KEY_' (or fails key validation). It is a generic input-validation guard; the at-fault input is the offending token embedded in the message, e.g. 'volume_up' or 'btn1'.

Solutions

  1. Rewrite the token as a valid KEY_ command, e.g. 'KEY_VOLUP' instead of 'volume_up'.
  2. Remove stray separators or typos that produced an unparseable token from splitting on ',', ';', '+', or newlines.
  3. Consult the supported Samsung/VIDAA key list and use one of the accepted KEY_ names.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs:28 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/9c0b14835a101b08. Report an issue: GitHub.

Appendix: source

Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/RemoteMacro.cs:28

        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)