mgth/LittleBigMouse · error · ArgumentOutOfRangeException

Enter a VIDAA picture-setting value between -1000 and 1000.

Error message

Enter a VIDAA picture-setting value between -1000 and 1000.

What it means

PictureSettingPayload validates the value parameter must be -1000..1000; otherwise ArgumentOutOfRangeException is thrown for value. This matches the VIDAA picture-setting slider range, so larger values would be rejected or misinterpreted by the TV.

Solutions

  1. Clamp the value to [-1000, 1000] before calling
  2. Convert your UI scale (e.g. 0..100) to the VIDAA value range explicitly
  3. Validate user input at the UI layer before building the payload
  4. Check the menu item's documented value range if a setting allows a smaller range

Example fix

// before
var payload = HisenseVidaaProtocol.PictureSettingPayload(5, brightness); // brightness may exceed 1000
// after
var v = Math.Clamp(brightness, -1000, 1000);
var payload = HisenseVidaaProtocol.PictureSettingPayload(5, v);
Defensive patterns

Strategy: validation

Validate before calling

if (value is < -1000 or > 1000) value = Math.Clamp(value, -1000, 1000);

Try / catch

try { payload = PictureSettingPayload(menuId, value); }
catch (ArgumentOutOfRangeException ex) { ui.Show(ex.ParamName + " out of range"); }

Prevention

When it happens

Trigger: Calling PictureSettingPayload with value < -1000 or > 1000, e.g. passing a 0..100 UI percentage mapped incorrectly, or an unclamped user slider value.

Common situations: UI slider scale mismatch (e.g. 0..2000 range sent raw); combining values from different settings with different scales; unit confusion between percentage and raw menu value.

Related errors


AI-assisted analysis of mgth/LittleBigMouse@7a42f01d47 (2026-09-16). Data as JSON: /api/errors/049bf9da52092456. Report an issue: GitHub.

Appendix: source

Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/HisenseVidaa/HisenseVidaaProtocol.cs:142

    public static string Topic(string service, string clientId, string action)
        => $"/remoteapp/tv/{service}/{clientId}/actions/{action}";

    /// <summary>
    /// The token exchange is asked for on a <c>data</c> topic rather than through
    /// <see cref="Topic"/>'s <c>actions</c> namespace.
    /// </summary>
    public static string TokenRequestTopic(string clientId)
        => $"/remoteapp/tv/platform_service/{clientId}/data/gettoken";

    /// <summary>An empty refresh token asks for a first pair of tokens.</summary>
    public static string TokenRequestPayload() => "{\"refreshtoken\":\"\"}";

    public static string PictureSettingPayload(int menuId, int value)
    {
        if (menuId is < 1 or > 999)
            throw new ArgumentOutOfRangeException(nameof(menuId), "Enter a VIDAA picture-setting menu ID between 1 and 999.");
        if (value is < -1000 or > 1000)
            throw new ArgumentOutOfRangeException(nameof(value), "Enter a VIDAA picture-setting value between -1000 and 1000.");
        return JsonSerializer.Serialize(new
        {
            action = "set_value",
            menu_id = menuId,
            menu_value = value,
            menu_value_type = "int",
        });
    }

    public static string PictureSettingsRequestPayload()
        => "{\"action\":\"get_menu_info\"}";

    public static bool TryParsePictureSettings(
        string topic,
        string payload,
        out IReadOnlyList<VidaaPictureSetting> settings)
    {
        settings = [];

View on GitHub (pinned to 7a42f01d47)