mgth/LittleBigMouse · error · InvalidOperationException

Enter the projector Wi-Fi MAC address first.

Error message

Enter the projector Wi-Fi MAC address first.

What it means

PowerOnAsync wakes a Hisense VIDAA projector by sending a Wake-on-LAN magic packet to the device's stored Wi-Fi MAC address. Before sending, it loads the configuration via Required(id) and checks that MacAddress is non-empty; if the MAC address was never configured (or was cleared), it throws InvalidOperationException telling the user to enter the projector Wi-Fi MAC address first.

Solutions

  1. Open the Hisense VIDAA configuration for this device id and enter the projector's Wi-Fi MAC address (see NormalizeMac for accepted formats).
  2. Find the MAC on the projector's network settings screen or from your router's DHCP lease list, then save the config and retry.
  3. Before calling PowerOnAsync, check the stored configuration: var c = store.Get(id); if (string.IsNullOrWhiteSpace(c?.MacAddress)) prompt for the MAC.
  4. Catch InvalidOperationException and direct the user to the MAC address field in the UI.

Example fix

// before
await service.PowerOnAsync(id); // throws if MacAddress missing
// after
var config = store.Get(id);
if (string.IsNullOrWhiteSpace(config?.MacAddress))
    throw new InvalidOperationException("Configure the projector Wi-Fi MAC address before power-on.");
await service.PowerOnAsync(id);
Defensive patterns

Strategy: validation

Validate before calling

var config = store.Get(id);
if (config is null || string.IsNullOrWhiteSpace(config.IpAddress))
    throw new InvalidOperationException("Associate a Hisense VIDAA projector first.");
if (string.IsNullOrWhiteSpace(config.MacAddress))
    throw new InvalidOperationException("Enter the projector Wi-Fi MAC address first.");
await service.PowerOnAsync(id);

Type guard

public static bool IsPowerOnReady(HisenseVidaaConfiguration? c) =>
    c is { IpAddress: { Length: > 0 }, MacAddress: { Length: > 0 } };

Try / catch

try { await service.PowerOnAsync(id); }
catch (InvalidOperationException ex) { ShowConfigError(ex.Message); /* direct user to MAC field */ }

Prevention

When it happens

Trigger: Calling PowerOnAsync(id) when HisenseVidaaConfiguration.MacAddress for that id is null, empty, or whitespace — e.g. the projector was added with only an IP address, or the MAC field was cleared after saving.

Common situations: Setting up a new projector without completing the MAC address field; configuring by IP only and assuming WoL will work; a config migration or manual edit dropping the MacAddress; powering on before the projector has ever been on the network to learn its MAC.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/HisenseVidaa/HisenseVidaaService.cs:193

            c.Brand = "his";
        }
        _store.Save(c);
    }
    /// <summary>
    /// Slower burst than Tizen, and the trailing delay is kept: awaiting PowerOnAsync
    /// therefore leaves the projector 150 ms to react before the caller reconnects.
    /// </summary>
    static readonly WakeOnLanOptions WakeOnLanBurst = new()
    {
        PacketCount = 3,
        Port = 9,
        DelayBetweenPackets = TimeSpan.FromMilliseconds(150),
        DelayAfterLastPacket = true,
    };

    public Task PowerOnAsync(string id, CancellationToken ct = default)
    {
        var c=Required(id); if (string.IsNullOrWhiteSpace(c.MacAddress)) throw new InvalidOperationException("Enter the projector Wi-Fi MAC address first."); return WakeOnLan.SendAsync(c.MacAddress, WakeOnLanBurst, cancellationToken: ct);
    }
    HisenseVidaaConfiguration Required(string id) => _store.Get(id) is { } c && !string.IsNullOrWhiteSpace(c.IpAddress) ? c : throw new InvalidOperationException("Associate a Hisense VIDAA projector first.");

    async Task<HisenseVidaaClient> ClientForAsync(string id, HisenseVidaaConfiguration configuration)
    {
        HisenseVidaaClient? previous = null;
        HisenseVidaaClient client;
        lock (_clientLock)
        {
            if (_clients.TryGetValue(id, out client!)
                && SameConnection(client.Configuration, configuration)) return client;

            previous = client;
            client = new HisenseVidaaClient(configuration);
            _clients[id] = client;
        }

        if (previous is not null) await previous.DisposeAsync().ConfigureAwait(false);

View on GitHub (pinned to 7a42f01d47)