{"record":{"id":"356ff980b461829d","repo":"AprilNEA/OpenLogi","slug":"multiple-standalone-lights-match-device-query-use-a-more","errorCode":null,"errorMessage":"multiple standalone lights match --device {query}; use a more specific value","messagePattern":"multiple standalone lights match --device (.+?); use a more specific value","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/openlogi-cli/src/cmd/light.rs","lineNumber":204,"sourceCode":"            _ => Err(anyhow!(\n                \"multiple standalone lights found; select one with --device\"\n            )),\n        };\n    };\n    let query = query.to_ascii_lowercase();\n    let mut matches = devices.iter().filter(|device| {\n        device.display_name.to_ascii_lowercase().contains(&query)\n            || device\n                .address\n                .identity\n                .to_ascii_lowercase()\n                .contains(&query)\n    });\n    let Some(device) = matches.next() else {\n        return Err(anyhow!(\"no standalone light matches --device {query}\"));\n    };\n    if matches.next().is_some() {\n        return Err(anyhow!(\n            \"multiple standalone lights match --device {query}; use a more specific value\"\n        ));\n    }\n    Ok(device)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::select;\n    use openlogi_core::device::{DeviceKind, RawDeviceAddress, StandaloneDevice};\n\n    fn device(name: &str) -> StandaloneDevice {\n        StandaloneDevice {\n            address: RawDeviceAddress {\n                vendor_id: 0x046d,\n                product_id: 0xc900,\n                usage_page: 0xff43,\n                usage_id: 0x0202,","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/AprilNEA/OpenLogi/blob/e846e6f4b4405e33bd6a9aaf949a482ce34cb6d8/crates/openlogi-cli/src/cmd/light.rs#L186-L222","documentation":"With a `--device` query supplied, if the substring filter matches two or more lights, `select` cannot pick a unique target and throws this error. The message instructs the user to make the query more specific rather than choosing arbitrarily.","triggerScenarios":"Passing a `--device` substring that case-insensitively matches the display name or identity of more than one standalone light while running `set_power`, `set_brightness`, or `set_temperature`.","commonSituations":"Two identical Litra units with near-identical names and a generic query like `--device litra`; a query that is a prefix shared by several serials; a name query that matches both a Glow and a Glow-connected variant.","solutions":["Lengthen the query so it matches exactly one light (e.g. use more of the serial number).","Use the device identity/serial substring instead of the shared display name.","List devices first to see which candidates the query collides with."],"exampleFix":"// before — ambiguous prefix\n$ openlogi light set-brightness 40 --device \"litra\"\nerror: multiple standalone lights match --device litra; use a more specific value\n\n// after\n$ openlogi light set-brightness 40 --device \"9A7C\"","handlingStrategy":"validation","validationCode":"let q = device_query.to_ascii_lowercase();\nlet count = devices.iter().filter(|d| {\n    d.display_name.to_ascii_lowercase().contains(&q)\n        || d.address.identity.to_ascii_lowercase().contains(&q)\n}).count();\nif count > 1 {\n    eprintln!(\"'{device_query}' is ambiguous ({count} matches); use a serial substring\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use serial-number substrings, which are unique per unit, rather than model names.","Test any scripted --device value against the full device list once.","When running multiple identical units, label them by serial in your config."],"tags":["cli","ambiguity","device-selection","user-input"],"backgroundTag":"invalid-argument-value","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"}