AprilNEA/OpenLogi · error

no online device matches `--device

Error message

no online device matches `--device {q}`.
  online devices:
{list}

What it means

Thrown by `no_match_err` when at least one HID++ device is online but none matches the user's `--device <q>` query. The error lists every online device as `name (route)` lines so the user can correct the query. Unlike the empty-list case, this proves enumeration works and the failure is purely name matching.

Solutions

  1. Copy the exact name from the error's `online devices:` list and re-run with that value.
  2. If the intended device is absent from the list, wake or reconnect it, then retry.
  3. Drop `--device` to let automatic selection pick the single online device (works when exactly one matches).
  4. Update the hardcoded name in your script/alias to the current device name.

Example fix

// before
$ openlogi diag dpi --device "MX Master 3"
// error: ... matches `--device MX Master 3`
// after: use the exact listed name
$ openlogi diag dpi --device "MX Master 3S"
Defensive patterns

Strategy: validation

Validate before calling

// verify the query matches an online device before invoking the command
let devices = enumerate_candidates()?;
let q = std::env::var("DEV").unwrap_or_default();
if !devices.iter().any(|d| d.name.eq_ignore_ascii_case(&q)) {
    eprintln!("{q} not online; online: {}", devices.iter().map(|d| d.name.as_str()).collect::<Vec<_>>().join(", "));
}

Try / catch

// on mismatch, fall back to printing the online list and exiting non-fatally
match run_with_query(query) {
    Err(e) if msg_contains(&e, "no online device matches") => {
        print_online_devices()?; // mirror the error's list for the user
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running a diagnostic subcommand with `--device <q>` where `<q>` does not case-insensitively match any online candidate's name — misspelled device name, querying a device that is offline while others are online, or using a partial name shorter/longer than the matcher accepts.

Common situations: Scripting with a hardcoded device name after the device was renamed or replaced; two similar Logitech devices where the wrong one's name was recorded; device asleep so only its siblings enumerate.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of AprilNEA/OpenLogi@e846e6f4b4 (2026-09-13). Data as JSON: /api/errors/82f30a9226a773ea. Report an issue: GitHub.

Appendix: source

Thrown at crates/openlogi-cli/src/cmd/diag.rs:93

                .unwrap_or_else(|| format!("Slot {}", paired.slot));
            out.push(Candidate { route, name });
        }
    }
    Ok(out)
}

/// Build a helpful "couldn't pick a device" error that lists what *is* online.
fn no_match_err(devices: &[Candidate], query: Option<&str>) -> anyhow::Error {
    if devices.is_empty() {
        return anyhow!("no online HID++ device found — is a Logi device paired and awake?");
    }
    let list = devices
        .iter()
        .map(|c| format!("    - {} ({})", c.name, c.route))
        .collect::<Vec<_>>()
        .join("\n");
    match query {
        Some(q) => anyhow!("no online device matches `--device {q}`.\n  online devices:\n{list}"),
        None => anyhow!(
            "could not pick a device automatically.\n  online devices:\n{list}\n  \
             pass --device <name> to choose one."
        ),
    }
}

/// Pick the device a diag should run against.
///
/// Selection order:
/// 1. If `query` is set, the first online device whose name contains it
///    (case-insensitive) — lets the user disambiguate explicitly.
/// 2. Else, if `required_features` is non-empty, the first online device whose
///    HID++ feature table exposes *any* of them. This is what stops a
///    mouse-only diag (DPI, SmartShift) from picking a paired keyboard when
///    several devices are online — a real hazard on Bluetooth-direct setups
///    where each device enumerates as its own inventory.
/// 3. Else, the first online device (the original behaviour).

View on GitHub (pinned to e846e6f4b4)