mgth/LittleBigMouse · error · InvalidOperationException

Enter the monitor Wi-Fi MAC address before using…

Error message

Enter the monitor Wi-Fi MAC address before using Wake-on-LAN.

What it means

SamsungTizenService.PowerOnAsync wakes the monitor via Wake-on-LAN, which requires the monitor's Wi-Fi MAC address in its stored configuration. If the MacAddress field is blank, the service throws InvalidOperationException before attempting the magic packet. The library refuses to send a packet that cannot possibly reach the device.

Solutions

  1. Set the monitor's Wi-Fi MAC address in the SamsungTizenConfiguration before calling PowerOnAsync
  2. Discover/enter the MAC via the display's network settings menu and save it through the service's configuration API
  3. Guard the UI so the Wake-on-LAN action is disabled until a MAC is configured

Example fix

// before
await service.PowerOnAsync(monitorId); // throws when MAC missing
// after
var config = service.GetConfiguration(monitorId);
if (string.IsNullOrWhiteSpace(config?.MacAddress))
    throw new InvalidOperationException("Configure the monitor MAC address first.");
await service.PowerOnAsync(monitorId);
Defensive patterns

Strategy: validation

Validate before calling

var config = store.Get(monitorId);
if (config is null || string.IsNullOrWhiteSpace(config.MacAddress))
    throw new InvalidOperationException("Enter the monitor Wi-Fi MAC address before using Wake-on-LAN.");

Type guard

static bool HasMac(SamsungTizenConfiguration? c) =>
    c is not null && !string.IsNullOrWhiteSpace(c.MacAddress);

Try / catch

try
{
    await service.PowerOnAsync(monitorId, ct);
}
catch (InvalidOperationException)
{
    // prompt user to configure the MAC address in settings
}

Prevention

When it happens

Trigger: Calling PowerOnAsync(monitorId) for a monitor whose SamsungTizenConfiguration.MacAddress is null, empty, or whitespace.

Common situations: The user paired the display by IP only; the MAC field was cleared during re-configuration; a config entry was created programmatically without the MAC; Wake-on-LAN was tried from a fresh install with imported partial settings.

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/bb8c791f0c971aa0. Report an issue: GitHub.

Appendix: source

Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/SamsungTizen/SamsungTizenService.cs:133

        {
            await SendKeyAsync(monitorId, key, cancellationToken).ConfigureAwait(false);
            if (delay > TimeSpan.Zero) await Task.Delay(delay, cancellationToken).ConfigureAwait(false);
        }
    }

    /// <summary>Tizen wakes on the first packet it hears; the repeats cover Wi-Fi loss.</summary>
    static readonly WakeOnLanOptions WakeOnLanBurst = new()
    {
        PacketCount = 3,
        Port = 9,
        DelayBetweenPackets = TimeSpan.FromMilliseconds(100),
    };

    public Task PowerOnAsync(string monitorId, CancellationToken cancellationToken = default)
    {
        var configuration = RequiredConfiguration(monitorId);
        if (string.IsNullOrWhiteSpace(configuration.MacAddress))
            throw new InvalidOperationException("Enter the monitor Wi-Fi MAC address before using Wake-on-LAN.");
        return WakeOnLan.SendAsync(
            configuration.MacAddress, WakeOnLanBurst, cancellationToken: cancellationToken);
    }

    SamsungTizenConfiguration RequiredConfiguration(string monitorId)
    {
        var configuration = _store.Get(monitorId);
        if (configuration is null || string.IsNullOrWhiteSpace(configuration.IpAddress))
            throw new InvalidOperationException("Associate a Samsung Tizen display first.");
        return configuration;
    }

    SamsungTizenClient ClientFor(string monitorId, SamsungTizenConfiguration configuration)
    {
        lock (_lock)
        {
            if (_clients.TryGetValue(monitorId, out var client)) return client;
            client = new SamsungTizenClient(configuration.IpAddress, configuration.Token);

View on GitHub (pinned to 7a42f01d47)