mgth/LittleBigMouse · error · CalibrationMeasurementException

ArgyllCMS could not obtain a measurement.

Error message

ArgyllCMS could not obtain a measurement.

What it means

VcpCalibrationHardware.MeasureAsync wraps an ArgyllCMS spot-read of the display via an external probe. When probe.SpotRead() returns false, meaning ArgyllCMS could not complete the color measurement (instrument error, no reading, aborted), the code throws CalibrationMeasurementException. This is a deliberate signal that no xyY color data is available, distinct from cancellation.

Solutions

  1. Verify the probe is connected and visible to ArgyllCMS (run spotread -? or list instruments) before calling MeasureAsync
  2. Retry the measurement once; spot reads can transiently fail while the display settles
  3. Ensure no other application is using the instrument exclusively
  4. Install/update ArgyllCMS and its instrument drivers, then retry

Example fix

// before
var result = await hardware.MeasureAsync(token);
// after
try
{
    var result = await hardware.MeasureAsync(token);
}
catch (CalibrationMeasurementException)
{
    // prompt user to check the probe connection and retry
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before measuring
if (!await probe.IsConnectedAsync()) throw new InvalidOperationException("Probe not connected");

Type guard

bool ProbeReady(IVcpProbe p) => p is { IsConnected: true };

Try / catch

try { var m = await hardware.MeasureAsync(token); }
catch (CalibrationMeasurementException ex) { log.Warn(ex, "Spot read failed"); /* retry or ask user */ }
catch (OperationCanceledException) { /* user aborted */ }

Prevention

When it happens

Trigger: Calling MeasureAsync when the probe's SpotRead fails: probe not detected by ArgyllCMS, measurement timeout, probe cannot sync to the display, or the underlying spotread tool returns failure.

Common situations: Colorimeter unplugged or on a busy USB hub; display showing an unstable/unmeasurable pattern; ArgyllCMS drivers not installed on Linux/Windows; another process holding the instrument; measurement attempted during display mode change.

Related errors


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

Appendix: source

Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/Calibration/VcpCalibrationHardware.cs:69

        if (control.Contrast is { } level) level.Value = ClampLevel(level, value);
        return Task.CompletedTask;
    }

    public Task SetGainsAsync(CalibrationRgb gains, CancellationToken cancellationToken)
    {
        cancellationToken.ThrowIfCancellationRequested();
        control.Gain?.SetTo([gains.Red, gains.Green, gains.Blue]);
        return Task.CompletedTask;
    }

    public async Task<CalibrationMeasurement> MeasureAsync(CancellationToken cancellationToken)
    {
        cancellationToken.ThrowIfCancellationRequested();
        using var registration = cancellationToken.Register(probe.Abort);
        var succeeded = await Task.Run(probe.SpotRead).ConfigureAwait(false);
        cancellationToken.ThrowIfCancellationRequested();
        if (!succeeded)
            throw new CalibrationMeasurementException("ArgyllCMS could not obtain a measurement.");

        var color = probe.ProbedColor;
        return new(
            color.xyY.Y,
            color.xyY.x,
            color.xyY.y,
            color.DeltaE00());
    }

    static uint ClampLevel(MonitorLevel level, uint value) => Math.Clamp(value, level.Min, level.Max);
}

View on GitHub (pinned to 7a42f01d47)