{"record":{"id":"5cbae385400622ef","repo":"AprilNEA/OpenLogi","slug":"message-candidates-list","errorCode":null,"errorMessage":"{message}. Candidates:{list}","messagePattern":"(.+?)\\. Candidates:(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/fixture/target_selection.rs","lineNumber":64,"sourceCode":"        return Err(selection_error(\n            \"the selected route is duplicated and cannot identify one target\",\n            candidates,\n        ));\n    }\n    Ok(selected)\n}\n\nfn selection_error<T: FixtureTarget>(message: &str, candidates: &[T]) -> anyhow::Error {\n    let mut list = String::new();\n    for candidate in candidates {\n        let _ = write!(\n            list,\n            \"\\n  - {:?} ({})\",\n            candidate.display_name(),\n            safe_route_label(candidate.route())\n        );\n    }\n    anyhow!(\"{message}. Candidates:{list}\")\n}\n\nfn safe_route_label(route: &DeviceRoute) -> String {\n    match route {\n        DeviceRoute::Bolt { slot, .. } => format!(\"Bolt receiver slot {slot}\"),\n        DeviceRoute::Unifying { slot, .. } => format!(\"Unifying receiver slot {slot}\"),\n        DeviceRoute::Direct {\n            vendor_id,\n            product_id,\n        } => format!(\"direct {vendor_id:04x}:{product_id:04x}\"),\n        DeviceRoute::RawHid {\n            vendor_id,\n            product_id,\n            usage_page,\n            usage_id,\n            ..\n        } => format!(\n            \"standalone {vendor_id:04x}:{product_id:04x} usage {usage_page:04x}:{usage_id:04x}\"","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/fixture/target_selection.rs#L46-L82","documentation":"Formatted error from `selection_error()` in target_selection.rs, raised when interactive/automatic target selection cannot find or disambiguate a device. The message embeds the caller's reason (`{message}`) plus a bullet list of available candidates with their display names and safe route labels (e.g. 'Bolt receiver slot 2'). It is the CLI's way of telling you exactly which devices were visible when selection failed.","triggerScenarios":"`select_target` invoked with a device filter/identifier that matches no enumerated candidate, or with no devices attached, or an ambiguous selection request — from both the inventory and standalone code paths.","commonSituations":"Typing a partial or misspelled device name in `--device`; the target device is powered off or out of receiver range; device is paired to a different receiver slot than expected; running before the receiver enumerates.","solutions":["Check the Candidates list in the error and use an exact display name or identifier from it","Confirm the device is powered on, awake, and within range of the receiver/dongle","Re-run `openlogi list` to refresh the device inventory, then retry selection","If the device appears under an unexpected route label, re-pair it or move it to another receiver slot"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"let candidates = standalone_inventory().await?;\nlet match = candidates.iter().find(|c| c.display_name() == wanted)\n    .ok_or_else(|| anyhow!(\"'{}' not attached; run `openlogi list`\", wanted))?;","typeGuard":"fn known_device(name: &str, candidates: &[Device]) -> Option<&Device> {\n    candidates.iter().find(|c| c.display_name() == name)\n}","tryCatchPattern":"match select_target(&devices, &filter) {\n    Ok(device) => apply(device),\n    Err(e) if e.to_string().contains(\"Candidates:\") => {\n        eprintln!(\"{}\\nRun `openlogi list` and retry with an exact name.\", e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Run `openlogi list` immediately before scripted light/device commands","Use exact identifiers or full display names, not partial matches","Verify the device is powered, awake, and paired to the expected receiver slot","Retry selection once after a short sleep if the device just woke from sleep"],"tags":["cli","device-selection","hardware"],"backgroundTag":"resource-not-found","analyzedSha":"e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8","analyzedAt":"2026-09-13T03:07:16.451Z","contentChangedAt":"2026-09-13T03:07:16.451Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}